ticket example added some transitions
ticket example; fixed math and reorganized code