refactoring: server functions