Refactor label and data generation to use the same indices