Move order & AI handling to ThinkingEntity. Some cleanup in documents.