Add some clarifying comments and refactor a portion of the `Keyring` class for readability.