added sorting for events