Fix typo and move revoke code