Added file wrapper and some cleanup.
Decoding.