setting up encoder, refactoring patterns