final changes and revoke function