Update Document class and add exception classes.