Agent should report a final ping before shutting down, refactor agent to use globals, don't delay controller before signaling agent to stop