handle transitions both ways