Changes for searching for the sample when at the goal node