Generalize to allow any type of barcode