refactored for root, parents, attach, detach, remove