moves calculation of the number of required segments into rules