Changed the encoder function, got rid of the decoder function