Function isExpectingEnd