Fixed pipelining code to work properly.

For reasons that I do not understand, using the built-in
scala functions to unroll the iterator leads to an empty iterator.
This commit changes the un-pipelining code to manually unroll the
iterator.