refactoring: flags moved to State.java class