adding and removing of subgoals