code refactoring on server side.