Move code out of init
Fix imports in tests
Fix import in management