Cleanup, mostly whitespace fixes.
Move common querysets to a shared module.