I am going to use a dict and sorting the entries on the fly as you suggested