Comment and import clean-up.
Pep 8 & Cleanup
Clean up pager.
Return facets and clean up facets generating code.
Further refactor the query functions for entities 
and relations.