updated Sanitize() function