Export of counting data implemented. Segmentation cost function slightly updated. (Higher penalty when close to avg.)