Refactoring, Introduced State struct