small refactoring for any state