         layoutTabIndicator()
     }
     
-    /// Position the marker below the tab
+    /// Repositions the indication marker below the tab
     func layoutTabIndicator() {
-        let labelF = tabLabels[selectedIndex].frame
+        let labelF = tabButtons[selectedIndex].frame
         tabIndicator.frame = CGRectMake(labelF.origin.x, labelF.size.height-4, labelF.size.width, 4)
     }
     

        let frame = CGRectMake(contentScrollView.frame.size.width * CGFloat(index), 0,
            contentScrollView.frame.size.width, contentScrollView.frame.size.height) ;
        if frame.origin.x < contentScrollView.contentSize.width {
            // Only disable parallax if scrollViewDidEndScrollingAnimation is gonna be called afterwards
            enableParallex = !animated
            
            // It doesn't look good if the tab's jumo back and then gets animated back
            var point = tabLabels[index].frame.origin
            point.x -= (titleScrollView.bounds.size.width - tabLabels[index].frame.size.width)/2
            titleScrollView.setContentOffset(point, animated: true)
            contentScrollView.scrollRectToVisible(frame, animated: animated)
        }
    }
    
    // MARK: Helpers
    
    private func generateTabs() {
        for label in tabLabels {
            label.removeFromSuperview()
        }
        tabLabels.removeAll(keepCapacity: true)
        
        let font = UIFont(name: "HelveticaNeue-Thin", size: 20)
        for var i = 0; i < self.viewControllerCount; i++ {

            button.titleLabel?.textAlignment = .Center
            button.sizeToFit()
            button.addTarget(self, action: "receivedButtonTab:", forControlEvents: .TouchUpInside)
            self.tabButtons.append(button)
            self.titleScrollView.addSubview(button)
        }
    }
    
    /// Action method to move the pager in the right direction
    public func receivedButtonTab(sender :UIButton)  {
        if let i = find(tabButtons, sender) {
            switchPage(i, animated:true)
        }
    }
