More refactoring to handle text from the web