added event sorting