Swap reference to ranges instead of copying arrays in each pass