changes p elements that contained chapter titles to head element