Fix db foreign keys and better return footnote highlighting