Added a binary encoder and test binary encoding