Server: refactoring