added error checking to palindrom