segment periods spannng mult days. lol when code works first time