Refactor into a class-based client.