Refactoring client code