Code to calculate quick events and soon events.