[INTERNAL] refactored code for modify string generation