add update hook, and _update_hierarchy() function