code: function cloneState(state) {
    return {
      options: state.options,
      stack: state.stack.slice(),
      nodes: state.nodes.slice()
    };
  }
docs: Helper for the places where we need to act asynchronously and keep track of
  where we are right now