I tried using an OrderedDefaultDict, but just sorting already did the trick
fixes #70