footnote images, refactor footnote code