public static void handleConnection(Socket socket) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
        out.println("Welcome to Minesweeper. " + numClients +  " people are playing including you. Type 'help' for help." + "\n");
        try {
            for (String line =in.readLine(); line!=null; line=in.readLine()) {
                String output = handleRequest(line, socket);
                if (output == "bye"){
                    synchronized(numClients){
                        numClients--;
                    }
                    out.flush();
                    socket.close();
                    break;
                }
                else if(output != null) {
                    out.println(output);
                    if (output == "BOOM!" + "\n"){
                        if (!debug){
                            synchronized(numClients){
                                numClients--;
                            }
                            out.flush();
                            socket.close();
                            break;
                        }
                    }
                    
                }
            }
        } finally {        
            out.close();
            in.close();
        }
    }