Little changes/refactoring/optimizations on simulated annealing