Working version; stores barcode (short) integer index rather than the barcode's string name.