Simplify state.cpp