Sort procedure of code