Finished moving out encoding/decoding into separate files (fixes #21)