basic client refactoring