 
     let model: Library
     var delegate: LibraryViewControllerDelegate?
+    var segmentedControl: UISegmentedControl
+    
+    var areTagsVisibles: Bool {
+        get {
+            return segmentedControl.selectedSegmentIndex == 0
+        }
+    }
     
     init(model: Library) {
         self.model = model
+        self.segmentedControl = UISegmentedControl(items: ["Tags", "Alphabetical"])
+        
         super.init(nibName: nil, bundle: nil)
         
         self.title = "Hacker Books Library"

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return self.model.numberOfTags()
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        let tagName = self.model.nameOfTagAt(index: section)
        return self.model.numberOfBookFromTag(tagName)
    }
    
    override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return self.model.nameOfTagAt(index: section)
    }
    
    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {

        
        let nib = UINib(nibName: "BookViewCell", bundle: nil)
        self.tableView.registerNib(nib, forCellReuseIdentifier: BookViewCell.cellId)
        
        self.segmentedControl.selectedSegmentIndex = 0
        self.segmentedControl.addTarget(self, action: #selector(selectedSegmentChanged), forControlEvents: .ValueChanged)
        
        self.navigationItem.titleView = self.segmentedControl
    }
    
    override func viewWillAppear(animated: Bool) {
