refactoring and cleanup of hyperopt client