Improves a lot the edges computation algorithm