added simulated annealing