refactored client to use multiple threads