Feature/state collapse. Fix #9