rewrote the stream api to use a mutable destination array for performance