#2: replaced use of collections.OrderedDict with ordereddict.OrderedDict for backwards compatibility with python < 2.7