Implementation of getDeliveryLocationBefore and getDeliveryLocationAfter