Fix dict order mangling

Use an OrderedDict to fix the mangling of the order of the input file.