OK so dbug generally works. Need to figure out buffering and cleanup