Refactor delivery code into its own package