added threshold and insertion for arrivals