Finished implementation of binary protocol