added setEnded()