Rewritten delivery calc. And some fixes as well