Refactored server code into server.c and handler.c