refactored text processor