Remove lingering <p> elements. Add heading IDs.

Hmm it seemed semantically wrong, but I haven't looked into it, so I'll take your word for it.