Got encoder class to work using fancy XOR methodology