var Stream = require('stream');

module.exports = function Sequence (options, sequence) {

    options = options || {};

    var seq = Stream.Transform({
        objectMode: typeof options.objectMode === 'undefined' ? true : !!options.objectMode,
        transform: function (chunk, enc, next) {

            var pos = -1;
            var handler;
            var runSeq = function (err, data) {

                // emit error
                if (err instanceof Error || (err && data === undefined)) {
                    err._ = chunk;
                    return next(err);
                }

                // just push data to readable if data and error is true
                // TODO call also data handlers with this data
                if (err && data === true) {
                    return seq.push(err);
                }

                // get handler
                if (!(handler = sequence[++pos])) {
                    return next(null, data);
                }

                // call next data handler
                if (!handler[4]) {

                    // once handler
                    if (handler[3]) {
                        handler[4] = true;
                    }

                    // attach flow composition options to caller arguments
                    options._ = handler[1];

                    // call data handler
                    handler[0].call(handler[2], options, data, runSeq);
                } else {
                    runSeq(null, data);
                }
            };

            if (!sequence) {
                return next(null, chunk);
            }

            runSeq(null, chunk);
        }
    });

    return seq;
};

@@ -610,124 +610,179 @@
  // 
-just push data to readable if data and error is true%0A                // TODO call also data handlers with this data%0A
+get handler%0A                if (!(handler = sequence%5B++pos%5D)) %7B%0A%0A                    // just push to next stream,%0A                    // if there are no more handlers%0A    
     
@@ -817,24 +817,28 @@
 === true) %7B%0A
+    
             
@@ -863,24 +863,92 @@
 .push(err);%0A
+                    %7D%0A%0A                    return next(null, data);%0A
             
@@ -965,33 +965,35 @@
              // 
-g
+res
 et handler%0A     
@@ -978,32 +978,49 @@
 // reset handler
+ position on push
 %0A               
@@ -1028,83 +1028,89 @@
 if (
-!(handler = sequence%5B++pos%5D)) %7B%0A                    return next(null, data)
+err && data === true) %7B%0A                    --pos;%0A                    data = err
 ;%0A  

fix data push