avoid long loops in construct_calendar