add links to table on per-authority and per-licence pages, some refactoring