Add functionality to sort by object key in selection sort