Added the rest of decoding. not quite there, but very close