a couple of minor JSHint-inspired fixes
added the step of the header's decoding and the final output