Minor code clean OrderedDict

reduce code duplication