improves last_delivery calculation