Refactored code. Added client_config_t