Client side code refactoring