more client code refactoring