module for watching state and acting on state changes