Server: Some refactoring.