Some refactoring and palindrome using stack exercise