added some tweaks and assertions
dropped bundled output writer