My edited version for barcode scanner