server side refactoring