And a refactor to save the array pointer per edge.
Also made it a bit easier to read the code.