rewrote the movetoedge code so it works with both types of edges (to edge and from...