Refactor client to use classes. Add first client test.
Address review comments.