finds endingBlock