working selection sort