first draft of fsm-like implementation
second draft of fsm-like implementation
ready for release