refactor initial state handling