refactored rightmost char