Updated all queries on tickets controller for sorting