Refactoring the Query code...
-- Adding comments
-- Moving some database stuff from the mapper to models.Query
-- Make some stuff private
Refactor email for permission numbers;  add much better error handling

and remove a bunch of no-long-needed Logger.debug calls.
Merge branch 'permNumEmail' into dev