Search queries: added select_related/prefetch_related to minimize database hits
Cleanup (template- and context-related code put into more readable shape)