number of stops refactor