     @discardableResult private func shouldAdjust(_: UITextView, range: NSRange, text: String) -> Bool {
         var shouldAdjust = true
 
-        if mentions |> mentionBeingEdited(at: range) |> clearMention() {
-            mentionsTextView.attributedText |>
-                replace(charactersIn: range, with: text) |>
-                selectRange(on: mentionsTextView)
+        if let clearedMention = mentions |> mentionBeingEdited(at: range) >=> clearMention(), clearedMention {
+            mentionsTextView.attributedText
+                |> replace(charactersIn: range, with: text)
+                |> selectRange(on: mentionsTextView)
+
             shouldAdjust = false
         }
 
-        mentions |> adjusted(forTextChangeAt: range, text: text)
+        mentions = mentions |> adjusted(forTextChangeAt: range, text: text)
 
         return shouldAdjust
     }

    @discardableResult public func addMention(_ createMention: CreateMention) -> Bool {
        guard let currentMentionRange = currentMentionRange else { return false }

        mentionsTextView.attributedText |>
            add(createMention, spaceAfterMention: spaceAfterMention, at: currentMentionRange, with: mentionTextAttributes) |>
            selectRange(on: mentionsTextView)
        mentions |> add(createMention, spaceAfterMention: spaceAfterMention, at: currentMentionRange)

        filterString = nil
        hideMentions()

    private func clearMention() -> (Mention?) -> Bool {
        return { mention in
            guard let mention = mention else { return false }
            self.mentions = self.mentions |> remove([mention])
            self.mentionsTextView.attributedText
                |> apply(self.defaultTextAttributes, range: mention.range)

            return true
        }
