moved sanitize function to helper