car controller sort corrections

made corrections to the sort function in the controller.