Cleaner code _sort_footnotes