almost works, adds unwanted  blank entry to initial dictionary
still having problems with null pointers on decode