re-factored the encoder (compressor)