Improve encoder interface