More flexible way to remove consecutive line breaks