tried to do the barcode scanning function