refactor edges