Changed selection sort to have fewer lines of code