restructures text into divs on the fly