Refactoring, added edge attributes.