Refactor managers into their own module.

Allows cleaner reuse outside of controllers. Small PEP8 fixes.