change period values and change calculation of threshold