WIP: Refactor certificate agent and queue

Details to follow...
I think tihs would be good. How do you fake an empty queue?