Adds support for multiple documents.
Improves default handling.