abstracted out a transition func