         if(selectedRowIndex > 0) {
             selectedRowIndex -= 1
         }
+
+        //when switching between rows, reset index to 0 only if switching between upper and lowercase
         if(selectedRowIndex != 0) {
             selectedCharIndex = 0
         }

        if(selectedRowIndex < keyboardRows.count - 1) {
            selectedRowIndex += 1
        }
        if(selectedRowIndex != 1 && selectedRowIndex != keyboardRows.count - 1) {
            selectedCharIndex = 0
        }

    }
    
    func updateSelectionDisplay() {
        let symbol = keyboardRows[selectedRowIndex][selectedCharIndex]
        selectionDisplay.text = symbol
        selectionDisplay.backgroundColor = rowColors[selectedRowIndex]
