Refactored the palindrome a bit