WIP: Refactor certificate agent and queue

Details to follow...
Isn't there some syntax for indicating that InvalidReturnCode comes from exceptions so that code browsers can follow the reference as a link?