cleaner implementation of a palindrome