Bug fix.  Forgot to take into account dictionaries are not guaranteed to be in any particular order.  Swapped the  dicts to ordered dicts.