Did some minor refactoring of client.