Lots of improvements to queries

Rearranged a lot of the view structure
Queries can now be saved
The layout of the data structures is not as clean as I'd like
I'm still trying to work out how much presentation stuff goes in the
report and how much in the query