starting to refactor state