sorting is implemented