The transition functions are a little bit of a mess and are mixed into the main code. Suggest creation a separate transitions object from which you can pick a preferred transition. Also provide set of callbacks.