refactoring clinet application