changed order of if/else and when to actually check for palindrome.