added isEnded method