fixed implementation for transition

logic is not yet efficient, will work to cleanup shortly.