Style.
Thread safety for streams.

* one more #todo marks.
Suppress debug log output while -O flag is set.