Finished the SA's implementation