WIP: Refactor certificate agent and queue

Details to follow...
I like this. This is much much nicer than the multiply-layered except's that littered certificate_agent; I just think it should be somewhere different.