 	
 	func viewDidSelected(_ gesture: UIGestureRecognizer) {
 		if let infinitif = self.infinitif {
-			if let lastUsedPlaylist = self.lastUsedPlaylist, let tense = self.tense, self.isQuizMode {
+			if let playlistName = self.playlistName, let tense = self.tense, self.isQuizMode, playlistName.isUserPlaylist {
 				self.lastUpdated = nil
-				let url = "iverb://quiz/\(lastUsedPlaylist.urlEncode!)/\(infinitif)#\(tense)"
+				let url = "iverb://quiz/\(playlistName.urlEncode!)/\(infinitif)#\(tense)"
 				self.extensionContext?.open(URL(string: url)!, completionHandler: nil)
 			} else {
 				let url = "iverb://verb#\(infinitif)"

		self.infinitif = key
		let comps = (value as! String).components(separatedBy: "|")
		guard (comps.count >= 3) else {
			completionHandler(NCUpdateResult.noData)
			return
		}
		
		var string = "To \(comps[0]), \(comps[1]), \(comps[2])\n"
		
		if (self.isQuizMode) {
			let playlistName = sharedDefaults!.string(forKey: kLastUsedPlaylistKey)
			// Ignore non-user playlist that starts and ends with "__"
			self.lastUsedPlaylist = (playlistName != nil && !playlistName!.hasPrefix("_") && !playlistName!.hasSuffix("_")) ? playlistName : nil
			
			if (self.lastUsedPlaylist != nil) {
				let index = Int(arc4random() % 2)
				self.tense = ["past", "past-participle"][index]
				string = "To \(comps[0]), "

	
	var urlEncode: String? {
		get {
			return addingPercentEncoding(withAllowedCharacters: .alphanumerics)
		}
	}
}

extension TodayViewController {
	
	private var LastUpdatedKey: String { return "lastUpdated" }
	fileprivate var lastUpdated: Date? {
		get {
			if let interval = UserDefaults.standard.object(forKey: LastUpdatedKey) as? Double {
				return Date(timeIntervalSinceReferenceDate: interval)
			}
			return nil
		}
		set {
			if let newValue = newValue {
				UserDefaults.standard.set(newValue.timeIntervalSinceReferenceDate, forKey: LastUpdatedKey)
			} else {
				UserDefaults.standard.removeObject(forKey: LastUpdatedKey)
			}
			UserDefaults.standard.synchronize()
		}
	}
}

extension String {
	
	var isUserPlaylist: Bool {
		return !(hasPrefix("_") && hasSuffix("_"))
	}
}

