Added checkEnd, checks accepting states