Added caching of computed paths. Changed compareTo to compare distances of paths instead of ops