Use ordered dictionaries to cut down on sorting (Python 2.7 and up only)