loadEventsIntoHeaders updated

eturns sorted array for database functions. Check for ID now also calls
this function.