Actually, we have a more serious problem here. I cannot create array in line 151, because will get O(n^2) algorithm. I have to reuse the array between different lowerNode values. However, this gets tricky, when using parallel foreach. I should have an array for each working thread and use sth like array's pool. I can do this, but I may be not very readable.