Refactored client into its own class