Moving the server functions into a single function.