Begin move to ORM
Update templates for removal of DB query count.
Update server page to use a single query and tidy code