Custom encoder

#34

I'm not sure about this approach, however it works and not influence on public API. Let me know what you think.
I forgot to remove it. Anyway, now you can do it right in your custom encoder.