Stopped buildRanges running out of memory on large data sets