Added Encoder Functionality
and fixed selector