Adds better error handling to parse_document