Loads of refactoring...merged lists in elements and got an index for the edges (just in case)...some other things as well done...read the code