Refactoring.

Improving the Simulated Annealing performance.