clean up Encoder class a lot