new segment method
Correct some mistakes in terms of calculating first dev and second dev