Lots of refactoring to the client.