WIP: Refactor certificate agent and queue

Details to follow...
Why wrap an inner run()? Why not just wrap the test?