Some adjustements to algorithm, getting rid of "skip loop body" path and average distance.