[Server] Code refactoring