Improved encoder