WIP refactoring client code