Server side code refactoring