Removing recursion from add() and remove().