Refactor into classes working client.