Implemented encoder.