partial refactoring of partial cart-to-packages auto-conversion algorithm