find start and exit points