Need to further review and define. Probably need hooks for user-defined states, in addition to some pre-defined ones.