begin to refactor client code