better state resetting