Refactor Palindrome