modified goal_detection