Functionality is now broken up between several files. Next step is to sanitise the code within each.
Some attempts at starting better error reporting. loadTags is now called whenever items are populated.