better state tracking