     
     @IBAction func previousButtonTapped(_ sender: UIButton) {
         print("previous")
+        self.selectPlaceholder(in: self.ranges.reversed(), with: smallerThan)
     }
     
     @IBAction func nextButtonTapped(_ sender: UIButton) {
         print("next")
-        self.selectNextPlaceholder()
+        self.selectPlaceholder(in: self.ranges, with: greaterThan)
     }
     
     // MARK: - Private functions

        }

        self.ranges = text.allRanges(of: self.placeholder)
        print("Found \(self.ranges.count) ranges")
    }
    
    
    private func selectNextPlaceholder() {
        guard let text = self.textView.text else {
            return
        }
        
        self.textView.becomeFirstResponder()

        self.updatePlaceholderRanges()
        
        // Find current cursor position
        guard let currentlySelectedRange = self.textView.selectedTextRange else {
            print("Couldn't find current range")
            return
        }
            
        var cursorPosition = self.textView.offset(from: self.textView.beginningOfDocument, to: currentlySelectedRange.start)
        print("Current position: \(cursorPosition)")
        
        for range in self.ranges {
            let rangeStart = text.distance(from: text.startIndex, to: range.lowerBound)
            let rangeEnd = text.distance(from: text.startIndex, to: range.upperBound)
            print("Range: \(range)")

            if rangeStart > cursorPosition {
                // Convert to UITextPosition, and set new selection
                let textPositionStart = self.textView.position(from: self.textView.beginningOfDocument, offset: rangeStart)
                let textPositionEnd = self.textView.position(from: self.textView.beginningOfDocument, offset: rangeEnd)

            }
        }
    }

    // MARK: - View cycle

    override func viewDidLoad() {
