changes API to use state objects instead of string ids
changed to also internally use state objects instead of state-id strings
changed handlers to now be an option hash for future extensibility