adding test for the client
refactored