add isEnded method