Better hook on state entry and exit.
