public void decodeAndRender(int id, String message) throws JSONException {
		switch (id) {
		
		case 100: // Chat message
			Message chatMessage = enc.chattMessageDecode(message);
			tg.chat.chatUpdate(chatMessage.message, chatMessage.user);
			break;
		
		case 201: // Move message
			TiarUserMessage mess = enc.tiarUserMessageDecode(message);
			if (this.started) {
				if (mess.isValid == 1) {
					tg.updateGameBoard(mess.Gameboard);
					tg.gl.changeTurn();
				} else
					tg.updateGameBoard(mess.Gameboard);
			
				if(mess.HasWon != 0){
					JOptionPane.showMessageDialog(null, "Player: " + Integer.toString(mess.HasWon) + " has won!", "Winner!", JOptionPane.INFORMATION_MESSAGE);
					tg.clearBoard();
				}
				if (mess.IsDraw ==1 ){
					JOptionPane.showMessageDialog(null, "The game is a draw!", "Draw!", JOptionPane.INFORMATION_MESSAGE);
					tg.clearBoard();
				}
				
			}
			break;
			
		case 202:
			StartableMessage tsm = enc.startebleMessageDecode(message);
			this.startable = tsm.isStartable;
			break;
			
		case 203:
			StartedMessage startedGame = enc.startedMessageDecode(message);
			this.started = startedGame.started;
			this.Player = startedGame.playerID;
			
			break;
			
		case 404:
			this.saveMsg = new StageFlipper(enc.kickMessageDecode(message));
			this.loop = false;
			break;

		default: 
			System.out.println(id + "\nstring: " + message);
			break;

		}

	}