WIP: Refactor certificate agent and queue

Details to follow...
Not special; arbitrary choice.