Currently inline fragments are merged in case two neighbouring fragments: 1. are from the same tool 2. the second fragment starts at index where the first one ends How it should work ideally: 1. Two fragments in the fragments array are from the same tool 2. The second fragment starts at index where the first one ends Naive solution would be O(n^2), we should think of more efficient solution