added first version of transition function