modified sortingcontroller and added some test