Added better state framework