Algorithm changed for splitting html content with link