Refinment on the sanitize function #366