private void sortInputQueue() {
		for (int out = inputQueue.size() - 1; out >= 1; out--) {
			for (int in = 0; in < out; in++) {
				
				// Only sort MulticastMessage
				if (inputQueue.get(in) instanceof MulticastMessage) {
					
					for (int j = in + 1; j <= out; j++) {
						if (inputQueue.get(j) instanceof MulticastMessage) {
							MulticastMessage prev = (MulticastMessage) inputQueue.get(in);
							MulticastMessage next = (MulticastMessage) inputQueue.get(j);
							// When these two messages are in same group, and previous one 
							// is before the next one, we swap
							if (prev.getGroupName().equalsIgnoreCase(next.getGroupName())
									&& prev.getClockForGroup().compareClock(next.getClockForGroup()) > 0){
								System.out.println("Test---- Swap occur!");
								// Swap
								MulticastMessage tmp = (MulticastMessage) inputQueue.get(in);
								inputQueue.set(in, inputQueue.get(j));
								inputQueue.set(j, tmp);
							}
							break;
						}
					}
				}
			}
		}
	}