Finished up the decoding bit for now. Working on encoding
Done for now. Still need to work on encoding but I have some questions for Peter about it.