Added auto-dist feature and set max barcode length to 1023.