Added palindrome checking algorithm