added some code for the encoders