Fixed bugs, implemented missing transitions.