Optimization in Multimedia
More performant function order
Fist check the state as it can cause a return, getting metadata before
that would be a waste if we are in a returning state.
Also add some empty lines for readability... one gets to think this
should be a class ;)