Refactor transition code.
Handle ticks more elegantly in transition.