Refactors the client, adds examples and documentation.