Fixes for latest rustc.
Implement output streams
Cleanup & make it a library crate