Fix transition logic
refactor transitions