updated redame / improved formatting of output file / added threhsold for segmentation detection