added goal logic