Implemented client protocol. Added compareTo and other fixes