Fixed missing output stream
Fixed toc generation
Added parameters