WIP: Refactoring: Improved Testing

Provide a much more rigorous test suite covering key areas of site functionality, to make sure that subsequent refactorings don't cause Bad Things™.