Rewrite the thing to use go-statemachine