added connected object segmentation
removed useless code