Refactored the client to be better at reusing it.