         self.view.addSubview(tabContainer)
         
         let viewDict:[String:UIView] = ["v0":self.tabContainer!]
-        let metrics:[String:CGFloat] = ["tabViewHeight":options.tabViewHeight, "tabContainerYPosition":options.viewPagerPosition.y]
-        
-        self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[v0]-0-|", options: NSLayoutFormatOptions(), metrics: nil, views: viewDict))
+        let metrics:[String:CGFloat] = ["tabViewHeight":options.tabViewHeight, "tabContainerYPosition":options.viewPagerPosition.y,"tabViewWidth":options.tabViewWidth]
+        
+        self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-0-[v0(tabViewWidth)]-(>=0)-|", options: NSLayoutFormatOptions(), metrics: metrics, views: viewDict))
         self.view.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-(tabContainerYPosition)-[v0(tabViewHeight)]", options: NSLayoutFormatOptions(), metrics: metrics, views: viewDict))
     }
     
+    
+    /**
+     * Creates and adds each tabs according to the options provided in tabcontainer.
+     */
+    fileprivate func setupTabs() {
+        
+        var totalWidth:CGFloat = 0
+        self.tabsList = dataSource.tabsForPages()
+        
+        if options.fitAllTabsInView! {
+            
+            // Calculating width for each tab
+            let eachLabelWidth = options.tabViewWidth / CGFloat (tabsList.count)
+            totalWidth = options.tabViewWidth * CGFloat(tabsList.count)
+            
+            // Creating view for each tab. Width for each tab is provided.
+            for (index,eachTab) in tabsList.enumerated() {
+                
+                let xPosition = CGFloat(index) * eachLabelWidth
+                let tabView = ViewPagerTabView()
+                tabView.frame = CGRect(x: xPosition, y: 0, width: eachLabelWidth, height: options.tabViewHeight)
+                tabView.setup(tab: eachTab, options: options, condition: ViewPagerTabView.SetupCondition.fitAllTabs)
+                
+                tabView.tag = index
+                tabsViewList.append(tabView)
+                tabContainer.addSubview(tabView)
+            }
+            
+        } else {
+            
+            var maxWidth:CGFloat = 0
+            
+            for (index,eachTab) in tabsList.enumerated() {
+                
+                let tabView = ViewPagerTabView()
+                let dummyFrame = CGRect(x: totalWidth, y: 0, width: 0, height: options.tabViewHeight)
+                tabView.frame = dummyFrame
+                
+                // Creating tabs using their intrinsic content size.
+                tabView.setup(tab: eachTab, options: options, condition: ViewPagerTabView.SetupCondition.distributeNormally)
+                
+                if !options.isEachTabEvenlyDistributed! {
+                    
+                    tabContainer.addSubview(tabView)
+                }
+                
+                tabView.tag = index
+                tabsViewList.append(tabView)
+                totalWidth += tabView.frame.width
+                maxWidth = getMaximumWidth(maxWidth: maxWidth, withWidth: tabView.frame.width)
+            }
+            
+            // Incase each tabs are evenly distributed, width is the maximum width among view tabs
+            if options.isEachTabEvenlyDistributed! {
+                
+                for (index,eachTabView) in tabsViewList.enumerated() {
+                    
+                    eachTabView.updateFrame(atIndex: index, withWidth: maxWidth, options: options)
+                    tabContainer.addSubview(eachTabView)
+                }
+                
+                totalWidth = maxWidth * CGFloat(tabsViewList.count)
+            }
+            
+            tabContainer.contentSize = CGSize(width: totalWidth, height: options.tabViewHeight)
+        }
+    }
+    
+    /**
+     * Sets up indicator for the page if enabled in ViewPagerOption. This method shows either tabIndicator
+     * or Highlights current tab or both.
+     */
+    func setupCurrentPageIndicator(currentIndex: Int, previousIndex: Int) {
+        
+        if options.isTabHighlightAvailable! {
+            
+            self.tabsViewList[previousIndex].removeHighlight(options: self.options)
+            UIView.animate(withDuration: 0.8, animations: {
+                
+                self.tabsViewList[currentIndex].addHighlight(options: self.options)
+            })
+        }
+        
+        self.currentPageIndex = currentIndex
+        
+        if options.isTabIndicatorAvailable! {
+            
+            let indicatorWidth = tabsViewList[currentIndex].frame.width
+            let indicatorHeight = options.tabIndicatorViewHeight!
+            let xPosition:CGFloat = tabsViewList[currentPageIndex].frame.origin.x
+            let yPosition = options.tabViewHeight - options.tabIndicatorViewHeight
+            
+            tabIndicator.backgroundColor = options.tabIndicatorViewBackgroundColor
+            
+            let dummyFrame = CGRect(x: xPosition, y: yPosition, width: 0, height: indicatorHeight)
+            let tabIndicatorFrame = CGRect(x: xPosition, y: yPosition, width: indicatorWidth, height: indicatorHeight)
+            
+            if !isIndicatorAdded {
+                
+                tabIndicator.frame = dummyFrame
+                tabContainer.addSubview(tabIndicator)
+                isIndicatorAdded = true
+            }
+            
+            UIView.animate(withDuration: 0.5, animations: {
+                
+                self.tabContainer.scrollRectToVisible(tabIndicatorFrame, animated: false)
+                self.tabIndicator.frame = tabIndicatorFrame
+                self.tabIndicator.layoutIfNeeded()
+            })
+        }
+    }
+    
+    /*--------------------------
+     MARK:- Tab setup helpers
+     ---------------------------*/
+    
+    /**
+     * Gesture recognizer for determining which tabview was tapped
+     */
     func tabContainerTapped(_ recognizer:UITapGestureRecognizer) {
         
         let tapLocation = recognizer.location(in: self.tabContainer)

    }
    
    /**
     ViewController the user will navigate to in forward direction
     */
    func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
        

    
    fileprivate var pageViewController:UIPageViewController!
    fileprivate var tabContainer:UIScrollView!
    fileprivate lazy var tabIndicator = UIView()
    
    fileprivate var tabsList = [ViewPagerTab]()
    fileprivate var tabsViewList = [ViewPagerTabView]()
    
    fileprivate var isIndicatorAdded = false
    fileprivate var currentPageIndex = 0
    
    var dataSource:ViewPagerControllerDataSource!
    var delegate:ViewPagerControllerDelegate?
    var options:ViewPagerOptions!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
