Cleaned up code for add-edge*.