Cleanup and commenting the server handling code.