Using sorted-map so loop state displays prettier.