             
             if proposedEdgeColor!.color.pc_isBlackOrWhite() {
                 
-                for i in 1...sortedColors.count {
+                for i in 0...sortedColors.count - 1 {
                     var nextProposedColor:PCCountedColor = sortedColors.objectAtIndex(i) as PCCountedColor
                     
                     if Double( nextProposedColor.count / proposedEdgeColor!.count) > 0.4 {  // make sure the second choice color is 40% as common as the first choice

    
    private func analyzeImage(inputImage:UIImage) -> Dictionary<String, UIColor>
    {
        var imageColors:NSCountedSet = NSCountedSet()
        var backgroundColor:UIColor = self.findEdgeColor(inputImage,colors:&imageColors);
        var primaryColor:UIColor?
        var secondaryColor:UIColor?
        var detailColor:UIColor?
        
        var darkBackground:Bool = backgroundColor.pc_isDarkColor()

        //self.findTextColors(imageColors, primaryColor:&primaryColor, secondaryColor:&secondaryColor, detailColor:&detailColor, backgroundColor:&backgroundColor)
            
        if primaryColor == nil {
            println("missed primary")
            if darkBackground {
                primaryColor = UIColor.whiteColor()
            } else {
                primaryColor = UIColor.blackColor()
            }
        }
        
        if secondaryColor == nil {
            println("missed secondary")
            if darkBackground {
                secondaryColor = UIColor.whiteColor()
            } else {
                secondaryColor = UIColor.blackColor()
            }
        }
        
        if detailColor == nil {
            println("missed detail")
            if darkBackground {
                detailColor = UIColor.whiteColor()
            } else {
                detailColor = UIColor.blackColor()
            }
        }

        var dict:Dictionary = Dictionary<String, UIColor>()
        
        dict[self.kAnalyzedBackgroundColor] = backgroundColor
        dict[self.kAnalyzedPrimaryColor]    = primaryColor
        dict[self.kAnalyzedSecondaryColor]  = secondaryColor
        dict[self.kAnalyzedDetailColor]     = detailColor
        
        return dict
    }
    
    private func findEdgeColor(inputImage:UIImage, inout colors:NSCountedSet) -> UIColor
    {
        
        var imageRep:CGImageRef = image.CGImage;

        //for curContainer: PCCountedColor in sortedColors as [PCCountedColor] {
        for index in 0...sortedColors.count-1 {
            
            var curContainer:PCCountedColor = sortedColors[index] as PCCountedColor

            curColor = curContainer.color;
            
            if primaryColor == nil {
                if curColor.pc_isContrastingColor(backgroundColor) {
                    var primaryColor:UIColor = curColor;
                }
            } else if secondaryColor == nil {
                if primaryColor.memory.pc_isDistinct(curColor) || curColor.pc_isContrastingColor(backgroundColor) {
                    continue;
                }
                secondaryColor.memory = curColor;
            } else if detailColor == nil {
                if secondaryColor.memory.pc_isDistinct(curColor) || primaryColor.memory.pc_isDistinct(curColor) || curColor.pc_isContrastingColor(backgroundColor) {
                    continue;
                }
                
                detailColor.memory = curColor;
                break;
            }
        }
