big refactor, improvement, cleaning of TextElement.merge_words