Small fixes.
Added centralized state.