lib/template.js
function(index){
	var obj = this._executionStack[index],
		i = index + 1,
		temp,t,setsOrModifies;
	while(i--){
		if(this._inAlready[i.toString()]) continue;
		temp = this._executionStack[i];
		if(temp.isAmbiguous){
			if(typeof temp.needs !== "undefined" && Object.keys(temp.needs).length !== 0) _orderNeedsByObject.call(this,i);
			this._executionOrders[0].unshift(i);
			this._inAlready[i.toString()] = true;
			continue;
		}
		setsOrModifies = [];
		if(typeof temp.modifies !== "undefined"){
			setsOrModifies = setsOrModifies.concat(Object.keys(temp.modifies));
		}
		if(typeof temp.sets !== "undefined"){
			setsOrModifies = setsOrModifies.concat(Object.keys(temp.sets));
		}
		t = setsOrModifies.length;
		while(t--){
			if(typeof obj.needs !== "undefined" && obj.needs[setsOrModifies[t]]){
				//We need this object
				if(typeof temp.needs !== "undefined" && Object.keys(temp.needs).length !== 0) _orderNeedsByObject.call(this,i);
				this._executionOrders[0].unshift(i);
				this._inAlready[i.toString()] = true;
				break;
			}
		}
	}
	return index;
}
function(index){
	var obj = this._executionStack[index],
		i = index + 1,
		temp,t,setsOrModifies;
	while(i--){
		if(this._inAlready[i.toString()]) continue;
		temp = this._executionStack[i];
		if(temp.isAmbiguous){
			if(typeof temp.needs !== "undefined" && Object.keys(temp.needs).length !== 0) _orderNeedsByObject.call(this,i);
			this._executionOrders[0].unshift(i);
			this._inAlready[i.toString()] = true;
			continue;
		}
		setsOrModifies = [];
		if(typeof temp.modifies !== "undefined"){
			setsOrModifies = setsOrModifies.concat(Object.keys(temp.modifies));
		}
		if(typeof temp.sets !== "undefined"){
			setsOrModifies = setsOrModifies.concat(Object.keys(temp.sets));
		}
		t = setsOrModifies.length;
		while(t--){
			if(typeof obj.needs !== "undefined" && obj.needs[setsOrModifies[t]]){
				//We need this object
				if(typeof temp.needs !== "undefined" && Object.keys(temp.needs).length !== 0) _orderNeedsByObject.call(this,i);
				this._executionOrders[0].unshift(i);
				this._inAlready[i.toString()] = true;
				break;
			}
		}
	}
	return index;
}
--module--
name:_orderNeedsByObject - private method
description: orders the execution stack based on where the current object is.
@param{number}
@param{boolean} - push or unshift the array.