Add configurable state handlers (setState, removeState, getState)

This is to fix issue #69 

Couldn't get unit tests to work. 
I hope this works for you.