docs: function validateExtendedStage(that, stageId, update, updateFunction) {
          var block, i, len;
          if ((updateFunction && update.id !== stageId) ||
              (!updateFunction && update.hasOwnProperty('id'))) {
  
              throw new Error('Stager.extendStage: id cannot be altered: ' +
                              stageId);
          }
          if (update.cb) {
              throw new TypeError('Stager.extendStage: update.cb cannot be ' +
                                  'specified. Stage id: ' + stageId);
          }
          if (update.init && 'function' !== typeof update.init) {
              throw new TypeError('Stager.extendStage: update.init must be ' +
                                  'function or undefined. Stage id:' +
                                  stageId);
          }
          if (update.exit && 'function' !== typeof update.exit) {
              throw new TypeError('Stager.extendStage: update.exit must be ' +
                                  'function or undefined. Stage id:' +
                                  stageId);
          }
          if (update.done && 'function' !== typeof update.done) {
              throw new TypeError('Stager.extendStage: update.done must be ' +
                                  'function or undefined. Stage id:' +
                                  stageId);
          }
          if (update.steps) {
              if (!J.isArray(update.steps)) {
                  throw new Error('Stager.extendStage: update.steps must be ' +
                                  'array or undefined. Stage id: ' + stageId +
                                  'Found: ' + update.steps);
              }
  
              if (!update.steps.length) {
                  throw new Error('Stager.extendStage: update.steps is an ' +
                                  'empty array. Stage id: ' + stageId);
              }
  
              // No changes to the steps array, just exit.
              if (J.equals(that.stages[stageId].steps, update.steps)) return;
  
              // Process every step in the array. Steps array is modified.
              handleStepsArray(that, stageId, update.steps, 'extendStage');
  
              // We need to get the enclosing steps block,
              // following the stage block.
              block = that.findBlockWithItem(stageId);
  
              // Stage is not in any block, just exit.
              if (!block) return;
  
              // We need to update the block in which the stage was.
  
              if ('undefined' !== typeof block.unfinishedItems[1]) {
                  block = block.unfinishedItems[1].item;
              }
              // The stage block was not ended yet,
              // so the the step block is the last of the sequence.
              else {
                  block = that.blocks[that.blocks.length -1];
              }
  
              // Remove all previous steps before adding the updated steps.
              block.removeAllItems();
  
              // Add steps to block (if necessary).
              i = -1, len = update.steps.length;
              for ( ; ++i < len ; ) {
                  // If the default step is contained in the list of updated
                  // steps, then it's not a default step and we keep it.
                  if (isDefaultStep(that.steps[update.steps[i]])) {
                      unmakeDefaultStep(that.steps[update.steps[i]]);
                  }
                  addStepToBlock(that, block, update.steps[i], stageId);
              }
          }
      }