Implemented improved event segmentation algorithm