public void run() {
		try {
		    out = new PrintWriter(socket.getOutputStream(), true);
		    in = new BufferedReader(
					    new InputStreamReader(
					    socket.getInputStream()));
		    String inputLine;
		    while (active) {
		    	if(username==null){
		    		username = in.readLine(); 
		    		//sendToClient("Welcome " + username + "!");
		    	}
		    	inputLine = in.readLine();
		    	//TODO problem: chat always send an empty line after each line
		    	if(inputLine.length() > 0)
		    		if(inputLine.substring(0, 1).equals("/"))
		    			specialCase(inputLine);
		    		else{
		    			tm.add(inputLine, username);
		    		}
		    }
		    close();
		} catch (IOException e) {
		    e.printStackTrace();
		} catch (NullPointerException e){
			if (out != null) //if the connection has been made once
				System.out.printf("Client %s from %s has exited the server\n", username, socket.getInetAddress().getHostName());
		}
    }