     var addMemberButton:UIButton!
 
     var verticalConstraints:[NSLayoutConstraint]?
-    var views:[String:AnyObject]!
+    var components:[UIView]!
 
     var group:Group!
     

        expensesTableView = ExpensesTableViewController()
        expensesTableView.delegate = self
        expensesTableView.view.translatesAutoresizingMaskIntoConstraints = false
        
        addChildViewController(summaryHeaderView)
        addChildViewController(summaryView)
        addChildViewController(expensesTableView)
        
        view.addSubview(summaryHeaderView.view)
        view.addSubview(summaryView.view)
        view.addSubview(addExpenseButton)
        view.addSubview(addMemberButton)
        view.addSubview(expensesTableView.view)
        
        views = ["summaryHeader":summaryHeaderView.view,"summary":summaryView.view, "expenses":expensesTableView.view, "addButton":addExpenseButton, "addMember":addMemberButton]

        recalculateVerticalConstraint()

        view.addConstraint(NSLayoutConstraint(item: addExpenseButton, attribute: .CenterY, relatedBy: .Equal, toItem: addMemberButton, attribute: .CenterY, multiplier: 1, constant: 0))
        view.addConstraint(NSLayoutConstraint(item: addExpenseButton, attribute: .Height, relatedBy: .Equal, toItem: addMemberButton, attribute: .Height, multiplier: 1, constant: 0))

        view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[summaryHeader]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views))
        view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[summary]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views))
        view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-[addButton]", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views))
        view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:[addMember]-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views))
        view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|-0-[expenses]-0-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views))
    }

    func GroupMembershipChanged(notification:NSNotification){
        recalculateVerticalConstraint()
    }

    func recalculateVerticalConstraint() {
        if verticalConstraints != nil {
            view.removeConstraints(verticalConstraints!)
        }

        var summaryHeight = group.members.count * 50
        if summaryHeight > 250 {
            summaryHeight = 250
        }
        verticalConstraints = NSLayoutConstraint.constraintsWithVisualFormat("V:|-72-[summaryHeader(30)]-0-[summary(\(summaryHeight))]-[addButton(38)]-[expenses]-|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: views)
        view.addConstraints(verticalConstraints!)

    }

    func refreshData(){

        view.backgroundColor = UIColor.whiteColor()

        summaryHeaderView = SummaryHeaderView()
        
        summaryView = SummaryTableViewController()
        summaryView.delegate = self
                
        addExpenseButton = createButton("+Expense", font: UIFont(name: "HelveticaNeue",size: 24)!)

