void parseMessage(Element root) {
		/*
			Messages may be chat messages, player moves or 
			game related messages e.g start game.
			This method will parse them and take appropriate action.
		*/
		String type = root.getAttribute("type"); // Null?
		if(type.equals("chat")) {
			Element from = (Element) root.getElementsByTagName("from").item(0);
    		Element body = (Element) root.getElementsByTagName("body").item(0);
    		client.showMessage(from.getTextContent(), body.getTextContent());
		}
		else if(type.equals("move")) {
			// Get current position of piece to move first.
			Element from = (Element) root.getElementsByTagName("from").item(0);
			Element xElem = (Element) from.getElementsByTagName("x").item(0);
			Element yElem = (Element) from.getElementsByTagName("y").item(0);
			int fromX = Integer.parseInt(xElem.getTextContent());
			int fromY = Integer.parseInt(yElem.getTextContent());

			// New position
			Element to = (Element) root.getElementsByTagName("to").item(0);
			Element toXElem = (Element) to.getElementsByTagName("x").item(0);
			Element toYElem = (Element) to.getElementsByTagName("y").item(0);
			int x = Integer.parseInt(toXElem.getTextContent());
			int y = Integer.parseInt(toYElem.getTextContent());


			Element col = (Element) root.getElementsByTagName("colour").item(0);
			String colour = col.getTextContent();

			// Move the piece
			client.movePiece(fromX, fromY, x, y, colour);

		}
		else if(type.equals("set")) {
			// Setting a piece on the board for the first time
			Element toXElem = (Element) root.getElementsByTagName("x").item(0);
			Element toYElem = (Element) root.getElementsByTagName("y").item(0);
			Element col = (Element) root.getElementsByTagName("colour").item(0);
			Element id = (Element) root.getElementsByTagName("id").item(0);
			int x = Integer.parseInt(toXElem.getTextContent());
			int y = Integer.parseInt(toYElem.getTextContent());

			if(col != null) {
				String colour = col.getTextContent();
				client.setPiece(x, y, colour);
			}
			else if(id != null) {
				int i = Integer.parseInt(id.getTextContent());
				client.setPiece(x, y, i);
			}
		}
		else {
			Element start, finish, turn = null;
			start = (Element) root.getElementsByTagName("start").item(0);
			finish = (Element) root.getElementsByTagName("finish").item(0);
			turn = (Element) root.getElementsByTagName("turn").item(0);

			if(start != null) {
				// Game is starting, show the board.
				client.setBoardVisible(true);
			}
			else if(finish != null) {
				client.gameOver();
			}
			else if(turn != null) {
				String name = turn.getTextContent();
				client.turn(name);
			}
		}
	}