Used map instead of queue. Now events are chained based on same timeout values reducing the need to iterate over all items in queue