breaking apart the encoder and decoder; lots of rewriting on the encoder to build objects that look nicer