Sanitize function added to handle malicious inputs