Refactoring of server with comment added.