Added intermediate vaiable for debugging period length