It looks like blocks of code have been deleted and added, but I have just rearranged the functions in a more logical order, IMHO:
 1. authorize_X functions.
 2. issue_X functions.
 3. verify_X functions.
 4. Internal functions.