refactoring client controller