WIP: Refactor certificate agent and queue

Details to follow...
Oh, of course. /me larts self.