began refactoring edgeSort
fixed edge sorting bug
cleaning up map.js