This is more concise and I think more logical. Complains welcome!
This refactor should make it cleaner to use mgmt.