Using a TreeMap for the queueing