slightly tidied palindrome prog