fix panics
refactor entering new state
add test for committed process