Moved server code to server.cc