Move BeautifulSoup import so we don't have to rely on it; fix some formatting.