remove use of the array and deal with a string as before
also keep unbreakable spaces on previous and next mark