Corrected incorrectly produced HTML where a div was embedded inside a P

Incorrect HTML produced. It would still render but any validation/linter would complain. To cut a long story short, DIV elements were made children of P elements.

This pull request fixes this problem.