readability refactoring in on_barcode()