Factorize the code related to the sot.