         self.setupDecriptedViews()
         
         self.defaultDataSetup()
-        self.refreshUI()
     }
     
     func defaultDataSetup(algorithmName: String, secret: String, token: String) {
         // algorithm HS256
-        if let index = self.model.availableAlgorithmsNames.index(where: {
+        if let index = self.model.availableAlgorithmsNames.firstIndex(where: {
             $0 == algorithmName
         }) {
             self.algorithmPopUpButton.selectItem(at: index)

    func textDidChange(_ notification: Notification) {
        self.refreshUI()
    }
}

// MARK: - EncodingTextViewDelegate


// Refresh UI
extension ViewController {
    // MARK: - Encoded Text View
    func encodedTextAttributes(_ enumerate: (NSRange, [NSAttributedString.Key : Any]) -> ()) {
        let textStorage = self.encodedTextView.textStorage!
        let string = textStorage.string
        let range = NSMakeRange(0, string.count)
        if let attributedString = self.model.appearance.encodedAttributedString(text: string, tokenSerialization: self.model.serialization) {
            attributedString.enumerateAttributes(in: range, options: []) { (attributes, range, bool) in
                enumerate(range, attributes)
            }
        }
    }
    
    // MARK: - Refresh UI
    func refreshUI() {
        
        let textStorage = self.encodedTextView.textStorage!;
        let string = textStorage.string
        self.encodedTextAttributes { (range, attributes) in
            textStorage.setAttributes(attributes, range: range)
        }
        
        // We should add an option to skip verification in decoding section.
