refactor footnote code into separate file.