refactored text helper