refactored server.go