         self.addChildViewController(selected_vc)
         selected_vc.didMove(toParentViewController: self)
         
-        switch viewControllers.count {
-        case 4:
-            if selectedIndex == 0 {
-                for i in 1...3 {
-                    self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 0.5)
-                }
-            } else {
-                self.animationConstraints[selectedIndex] = self.animationConstraints[selectedIndex]?.setMultiplier(multiplier: 2)
-                for i in 1...3 {
-                    if selectedIndex != i {
-                        self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 1)
-                    }
-                }
-            }
-        case 5:
-            if selectedIndex == 0 {
-                for i in 1...4 {
-                    self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 0.5)
-                }
-            } else {
-                self.animationConstraints[selectedIndex] = self.animationConstraints[selectedIndex]?.setMultiplier(multiplier: 2)
-                for i in 1...4 {
-                    if selectedIndex != i {
-                        self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 1)
-                    }
-                }
-            }
-        default:
-            // Animate withoud width changes
-            break
-        }
+        self.animateTabbar()
+        
         let previous_vc = self.viewControllers[previousIndex]!
         
         UIView.animate(withDuration: 0.3, animations: {

                home.didMove(toParentViewController: self)
                images[selectedIndex]?.isHighlighted = true
                labels[selectedIndex]?.textColor = self.selectedTint
            } else {
                print("The view controller selcted as initialViewController has not been configured. Make sure you added the material view segue and that the identifier is configured correctly")
            }

        }
    }
    
    private func animateTabbar() {
        switch viewControllers.count {
        case 4:
            if selectedIndex == 0 {
                for i in 1...3 {
                    self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 0.5)
                }
            } else {
                self.animationConstraints[selectedIndex] = self.animationConstraints[selectedIndex]?.setMultiplier(multiplier: 2)
                for i in 1...3 {
                    if selectedIndex != i {
                        self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 1)
                    }
                }
            }
        case 5:
            if selectedIndex == 0 {
                for i in 1...4 {
                    self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 0.5)
                }
            } else {
                self.animationConstraints[selectedIndex] = self.animationConstraints[selectedIndex]?.setMultiplier(multiplier: 2)
                for i in 1...4 {
                    if selectedIndex != i {
                        self.animationConstraints[i] = self.animationConstraints[i]?.setMultiplier(multiplier: 1)
                    }
                }
            }
        default:
            // Animate withoud width changes
            break
        }
    }
    
    
    
    @objc func respondToSwipeGesture(gesture: UIGestureRecognizer)
