Changed inverover and nn_tsp code