completed changes on selection sort