Improved the checkout algorithm slightly so that pay by cash amount is minimum