Update to code

Created a better way to loop through pages ref: TableHeadersRepeat 
Remove HR if there are no footnotes