     
     @IBAction func copyTypeChanged(button: NSPopUpButton!) {
         copyType = button.indexOfSelectedItem
+        preferences.setInteger(copyType, forKey: CopyTypeKey)
+        preferences.synchronize()
     }
     
     // MARK: Functions

    let TableTextNoResults = "No Results Found"
    let TableTextError = "Error Loading Palettes :("
    let PaletteCellIdentifier = "PaletteCell"
    let PalettesEndpoint = "http://www.colourlovers.com/api/palettes"
    let TopPalettesEndpoint = "http://www.colourlovers.com/api/palettes/top"
    
    // MARK: Properties
    
    var manager = AFHTTPRequestOperationManager()
    var showingTopPalettes = true
    var scrolledToBottom = false
    var noResults = false

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let window = NSApplication.sharedApplication().windows[0] as NSWindow
        window.delegate = self
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "scrollViewDidScroll:", name: NSViewBoundsDidChangeNotification, object: scrollView.contentView)
        
        setupCopiedView()
        setupTableText()
        setupAnimations()
        getPalettes(endpoint: TopPalettesEndpoint, params: nil)
    }
    
    override func viewDidAppear() {
        if let lastCopyType = preferences.valueForKey(CopyTypeKey) as? Int {
            copyType = lastCopyType
            let window = NSApplication.sharedApplication().windows[0] as NSWindow
            window.delegate = self
            let popUpButton = window.toolbar?.items[1].view? as NSPopUpButton
            popUpButton.selectItemAtIndex(copyType)
        }
    }
    
    deinit {
