Various updates

Use global vars.

Minor database restructuring.

Start getting data from outputs index for addresses page.