revised is_palindrome