optimize writer