+ moved SafeWriter to core so it can be used by cli also