Minor safety refactoring, testing organizeHierarchy