Working version with streaming IO
Removed some trace statements
Streaming IO, JS build broken