started using FSM and pouchdb
require javascript-state-machine
cleanup