function flatten(arg, flattened) {
        if(typeof flattened === 'undefined') {
            flattened = [];
        }
        if(Array.isArray(arg)) {
            arg.forEach(function (item) {
                flatten(item, flattened);
            });
        } else {
            flattened.push(arg);
        }
        return flattened;
    }
Returns a flattened array
@param {Array} arg - the array to be flatten
@param {Array} flattened - carries the flattened array - if not defined, will initialize to []
@returns {Array} - the flattened array