 
     public var height: CGFloat? {
         willSet {
-            var menuFrame = frame
+            var menuFrame = self.frame
             menuFrame.size.height = newValue!
             menuContentTable?.frame = menuFrame
             self.height = newValue

        dismissStatusBar()
        
        let selectedItem = items[indexPath.row - startIndex]
        animateMenuClosingWithCompletion(selectedItem.completion!)
    }
    
    public func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {


    //MARK:Animation and menu operations

    public func menuOpening(#animated: Bool) {
        if currentState != .Shown {
            showStatusBar()
            if let x = contentController?.view.center.x {
                
                UIView.animateWithDuration(0.2, animations: {[unowned self]() -> Void in
                    
                    self.contentController?.view.center = CGPointMake(x, UIScreen.mainScreen().bounds.size.height/2 + self.height!)
                    
                }, completion: {[unowned self](finished: Bool) -> Void in
                    
                    UIView.animateWithDuration(0.2, animations: {[unowned self]() -> Void in
                        self.contentController?.view.center = CGPointMake(x, UIScreen.mainScreen().bounds.size.height/2 + self.height! - bounceOffset)
                    }, completion: {(finished: Bool) -> Void in
                        self.currentState = .Shown
                    })

                })
            }
        }
    }
    
    public func menuClosingWithCompletion(#animated:Bool, completion: completionHandler?) {
        dismissStatusBar()
        if let center = contentController?.view.center {
            
            if animated {
                UIView.animateWithDuration(0.2, animations: {[unowned self] in
                    self.contentController?.view.center = CGPointMake(center.x, center.y + bounceOffset)
                    
                    }, completion: {[unowned self](finished: Bool) -> Void in
                        
                        UIView.animateWithDuration(0.2, animations: {[unowned self] in
                            self.contentController?.view.center = CGPointMake(center.x, UIScreen.mainScreen().bounds.size.height/2)
                            }, completion: {(finished: Bool) -> Void in
                                self.currentState = .Closed
                                completion?()
                            }
                        )
                    }
                )
            } else {
                contentController?.view.center = CGPointMake(center.x, UIScreen.mainScreen().bounds.size.height/2)
                currentState = .Closed
            }
        }
    }

    public func openMenuFromCenterWithVelocity(velocity: CGFloat) {
        showStatusBar()
        
        let viewCenterY = UIScreen.mainScreen().bounds.size.height/2 + height! - bounceOffset
        currentState = .Displaying
        let duration = Double((viewCenterY - contentController!.view.center.y) / velocity)
        UIView.animateWithDuration(duration, animations: {[unowned self]() -> Void in
            
            if let center = self.contentController?.view.center {
                self.contentController?.view.center = CGPointMake(center.x, viewCenterY)
            }
            
        }, completion: {[unowned self](finished: Bool) -> Void in
            self.currentState = .Shown
        })
