Added functions to alligne events in time and grouping events