AgentResource and SRef, plus other tweaks