keychain refactor