Currently, the example generation logic loops over the examples in the provided directory and adds them sequentially. Measure-based headers are added as needed when an example is associated with a different measure than its predecessor. If examples are not already in measure order, there will be multiple headers for a measures. Update the logic to do a pre-sorting step.