update Node class and isPalindrome class