Refactor perform()
Add doctypes module (prep to output doctypes)