         delegate.tags.insert("", atIndex: idx)
         let indexPath = NSIndexPath(forRow: idx, inSection: 0)
         collectionView.insertItemsAtIndexPaths([indexPath])
-        let cell = collectionView.cellForItemAtIndexPath(indexPath) as tagCell
-        cell.textField.becomeFirstResponder()
+        
+        UIView.animateWithDuration(0.2, animations: { () -> Void in
+          self.collectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: .CenteredHorizontally, animated: false)
+        }, completion: { (complete) -> Void in
+          if let cell = self.collectionView.cellForItemAtIndexPath(indexPath) as? tagCell {
+            cell.textField.becomeFirstResponder()
+          }
+        })
         return false
       }
     }

      }
      delegate.tags[delegate.currentIndex] = textField.text
      textField.frame = CGRectMake(rectHold.origin.x, rectHold.origin.y, width, resultFrame.size.height)
      collectionView.scrollToItemAtIndexPath(NSIndexPath(forRow: delegate.currentIndex, inSection: 0), atScrollPosition: .Left, animated: true)
    }
  }
}


class TagDelegate: TagProtocol {
  private var tags: [String] = [String]()
  private var tagDelegate: TagCollectionViewDelegate!
  private var tagDataSource: TagDataSource!
  var currentIndex: Int = 0
  
  convenience init(tags: [String]) {
    self.init()
    var temp = tags
    temp.append("")
    self.tags = temp
  }
  
  func setupDelegateAndDataSource(collectionView: UICollectionView) -> (delegate: TagCollectionViewDelegate, dataSource: TagDataSource) {
    tagDelegate = TagCollectionViewDelegate()
    tagDelegate.delegate = self
    tagDataSource = TagDataSource(collectionView: collectionView)
    tagDataSource.delegate = self
    return (tagDelegate, tagDataSource)
  }
  
  func getTags() -> [String] {
