'use strict';

var util = require('./util');

exports = module.exports = Stack;

function Stack(sites, attach){
  if(!(this instanceof Stack)){ return new Stack(sites); }
  if(!arguments.length){ return this; }

  var top = sites.length;
  var context = sites[--top];
  if(util.type(context).plainObject){
    util.merge(this, context); --top;
  }

  if(!attach){ return this; }
  for(var index = top; index > -1; --index){
    if(typeof sites[index] === 'function'){
      this.push(sites[index]);
    }
  }
}
util.inherits(Stack, Array);

@@ -74,16 +74,143 @@
 Stack;%0A%0A
+/**%0A * Stack%0A * @constructor%0A * @param sites %7BArguments%7CArray%7D%0A * @param pushSites %7BBoolean%7D%0A * @returns %7BStack%7D instance%0A */%0A%0A
 function
@@ -223,22 +223,25 @@
 (sites, 
-attach
+pushSites
 )%7B%0A  if(
@@ -482,14 +482,17 @@
 if(!
-attach
+pushSites
 )%7B r

add a litle jsdoc, pushSites instead of attach for the argument name is more descriptive