modified encoder