almost there on the encoder