Added function to sanitize input