Improve footnote process by kppvh.
Fixed missing parameter.
Fixed uninitialized variable.
Added main(), for testing
Fixed 2 incomplete regexes.