@Override
        public void run() {
            //LOG.log(Level.INFO, "New Thread spawned for client at port: {0}", clientPort);
            try {
                reader = new BufferedReader(new InputStreamReader(client.getInputStream()));

                String request = "";

                while (!client.isClosed() && (request = reader.readLine()) != null) { // we end this loop when no request has been recieved or socket is closed

                    String[] commands = request.split("\\s");

                   //LOG.log(Level.INFO, "Responding to request from client {0}: {1}", new Object[]{clientPort, request});

                    dispatch(commands, client);

                   // LOG.log(Level.INFO, "Response sent to client at port {0}", clientPort);
                }

            } catch (Exception ex) {
                LOG.log(Level.SEVERE, null, ex);
            } finally {
                try {
                    reader.close();
                    client.close();
                   // LOG.log(Level.INFO, "Client {0} disconnected. Ending thread.", clientPort);
                } catch (IOException ex) {
                    LOG.log(Level.SEVERE, null, ex);
                }
            }
        }