optimize barcodes code