Adding framework for state handling