Merge stated.cpp and state.cpp