 
 import UIKit
 
-class ViewController: UIViewController, SettingsPopoverDelegate {
-
+class ViewController: UIViewController {
+    
     static let numColors = 16
     static let numColumns = 4
-        
-    var settingsPopover : SettingsPopover?
+    
     @IBOutlet var settingsButton: UIButton?
     let saturation = 60 // 0-100
     let brightness = 85 // 0-100
     
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        setupSettingsView()
-    }
-    
-    func setupSettingsView() {
+    lazy var settingsPopover : SettingsPopover = {
         
         if !self.isViewLoaded {
             fatalError()

            }
        }
    }
    
    
    
    func settingsPopover(_ settingsPopover: SettingsPopover, didSelectIndex index: Int) {
        let color = self.settingsPopover(settingsPopover, colorAt: index)

        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.right, relatedBy:.equal, toItem:self.settingsButton, attribute:.left, multiplier:1.0, constant:-6.0))
        self.view.addConstraint(NSLayoutConstraint(item:popover, attribute:.bottom, relatedBy:.equal, toItem:self.settingsButton, attribute:.top, multiplier:1.0, constant:-6.0))
        
        popover.reloadColors()
        
        return popover
    }()
    
    
    func isSettingsPopoverVisible() -> Bool {
        
        let popover = self.settingsPopover
        
        if popover.alpha > 0 {
            return true
