Refactor TextTool