changed formatting of path string, added sorting for best path