Modified the "scan" method to process "quantity"