encoder and moving APIs to namespace