Improve barcode formatter speed, add tests for it