Added support for Encoder with custom differences