Added Encoder code