added tests and removed binary encoding