         XCTAssertEqual(savedItem2, fetchedItem2)
 
         // Remove the first token from the keychain
-        let delete1success = Keychain.sharedInstance.deleteTokenItem(savedItem1)
+        let delete1success = keychain.deleteTokenItem(savedItem1)
         XCTAssertTrue(delete1success, "Failed to remove from keychain: \(token1)")
 
-        let checkItem1 = Keychain.sharedInstance.tokenItemForPersistentRef(savedItem1.persistentRef)
+        let checkItem1 = keychain.tokenItemForPersistentRef(savedItem1.persistentRef)
         XCTAssertNil(checkItem1, "Token should not be in keychain: \(token1)")
-        let checkItem2 = Keychain.sharedInstance.tokenItemForPersistentRef(savedItem2.persistentRef)
+        let checkItem2 = keychain.tokenItemForPersistentRef(savedItem2.persistentRef)
         XCTAssertNotNil(checkItem2, "Token should be in keychain: \(token2)")
 
         // Remove the second token from the keychain
-        let delete2success = Keychain.sharedInstance.deleteTokenItem(savedItem2)
+        let delete2success = keychain.deleteTokenItem(savedItem2)
         XCTAssertTrue(delete2success, "Failed to remove from keychain: \(token2)")
 
-        let recheckItem1 = Keychain.sharedInstance.tokenItemForPersistentRef(savedItem1.persistentRef)
+        let recheckItem1 = keychain.tokenItemForPersistentRef(savedItem1.persistentRef)
         XCTAssertNil(recheckItem1, "Token should not be in keychain: \(token1)")
-        let recheckItem2 = Keychain.sharedInstance.tokenItemForPersistentRef(savedItem2.persistentRef)
+        let recheckItem2 = keychain.tokenItemForPersistentRef(savedItem2.persistentRef)
         XCTAssertNil(recheckItem2, "Token should not be in keychain: \(token2)")
 
         // Try to remove both tokens from the keychain again
-        let redelete1success = Keychain.sharedInstance.deleteTokenItem(savedItem1)
+        let redelete1success = keychain.deleteTokenItem(savedItem1)
         XCTAssertFalse(redelete1success, "Removing again should fail: \(token1)")
-        let redelete2success = Keychain.sharedInstance.deleteTokenItem(savedItem2)
+        let redelete2success = keychain.deleteTokenItem(savedItem2)
         XCTAssertFalse(redelete2success, "Removing again should fail: \(token2)")
     }
 

        XCTAssertEqual(token.generator.secret, NSData(bytes: kValidSecret, length: kValidSecret.count))

        // Save the token
        guard let keychainItem = Keychain.sharedInstance.addToken(token) else {
            XCTFail("Failed to save token to keychain")
            return
        }

        // Restore the token
        guard let secondKeychainItem = Keychain.sharedInstance.tokenItemForPersistentRef(keychainItem.persistentRef) else {
                XCTFail("Failed to recover keychain item for persistent ref")
                return
        }


let kValidTokenURL = NSURL(string: "otpauth://totp/L%C3%A9on?algorithm=SHA256&digits=8&period=45&secret=AAAQEAYEAUDAOCAJBIFQYDIOB4")!

class TokenPersistenceTests: XCTestCase {
    let keychain = Keychain.sharedInstance

    func testTokenWithKeychainItemRef() {
        // Create a token
        guard let token = Token.URLSerializer.deserialize(kValidTokenURL) else {
