Refactoring server side