Refactored client a lot. Removed dead code.