Improved sanitize callback