Hooking up buffered writer correctly