made the sort generic