isPalindrome method added