Added hook for state changes