refactored the code passing client in the initialize, refatored the test,