Changed HTML replacement code to handle multiple spans per item.