refactoring on server controller