Refactor reset state to reset flag