Added an error number.
Added root cnode to domain_info, and refactored domain management and cleanup.