Reworked initial counting of stops.