Cleanup of domains and better isDone error handling