Iterate over keys in sorted order