refactor encoding into new module
using cabal