Implement ticket functions.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Sorted lists iteration 3 (implement the rest)

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>