edited simulated annealing, WORKING NOW!