Port to Nokogiri, rather than parsing HTML by hand