Added history for the recursive subgoal problem