Added check goal function