Restructure text and add correct html tags