@SuppressWarnings("resource")
    public static void main(String[] args) {
        // Record the starting timestamp and set the thread name for debugging 
        // purposes
        serverStartTime = (new Date()).getTime();
        Thread.currentThread().setName("Main Thread");
        
        // Read the port from the command line arguments
        if (args.length != 1) {
            System.out.println("Usage: <Port>");
            System.exit(0);
        }
        
        // Open the server socket
        ServerSocket parentSocket = null;
        
        try {
            int listenBacklog = 50;
            // Create the socket. Address 0.0.0.0 indicates that the socket
            // will accept connections on any of the interfaces of the server
            parentSocket = 
                      new ServerSocket(Integer.parseInt(args[0]), listenBacklog,
                                       InetAddress.getByName("0.0.0.0"));
        } catch (IOException e) {
            System.out.println("Unable to open server socket: " +
                               e.getMessage());
            System.exit(0);
        } catch (NumberFormatException e) {
            System.out.println("Invalid port: " + args[0]);
            System.exit(0);
        } catch (IllegalArgumentException e) {
            System.out.println("Port not in range: " + args[0]);
            System.exit(0);
        }
        
        System.out.println("Server starting...\n");
        
        // Code for testing purposes. These players are not actually playing.
        // UNCOMMENT FOR DEBUGGING: 
        // String sampleNames[] = {"Austin", "Daniel", "Kevin", null};
        // lobbyGames.put("Ultimate Showdown", sampleNames);
        
        int totalThreadsCreated = 0; // Counter used for debugging purposes
        
        // Accept connections and start new threads for each connection
        while (true) {
            try {
                Socket childSocket = parentSocket.accept();
                
                // Check whether the maximum number of connections is being used
                if (numberConnections.get() < MAX_CONNECTIONS) {
                    numberConnections.getAndIncrement();
                    
                    totalThreadsCreated++;
                    
                    Thread connectionThread = 
                           new Thread(new ServerConnectionHandler(childSocket));
                    
                    // Set name for debugging purposes
                    connectionThread.setName("Handler Thread " +
                                             totalThreadsCreated);
                    
                    connectionThread.start();
                    
                } else {
                    // Notify the client that it cannot be served at this moment
                    ObjectOutputStream outputStream = new ObjectOutputStream(
                                                 childSocket.getOutputStream());
                    outputStream.writeObject(CONN_LIMIT_MSG);
                    outputStream.flush();
                    
                    childSocket.close();
                }
            } catch (IOException e) {
                printServerMsg("Error accepting new connection: " +
                                   e.getMessage());
            }
        }
    }