CLN: adf
CLN: add tests for ordering
BUG: fix ordering by using an OrderedDict instead of a set