Working palindrome function