Cleaned up the sanitize function