Simple implementation using OrderedDict