Added some keyring-related features. Refactoring