Tidy up "functions.inc"

Escape single quotes for TABLE and HREF
Updated closing TR tag