Fixed selection sorting and some code for test