 
         // If there aren't enough data items to fill the grid, look for items in suggested sites.
         if let layout = collectionView.collectionViewLayout as? TopSitesLayout {
-            return min(data.count + suggestedSites.count, layout.thumbnailCount)
+            return min(data.count + SuggestedSites.count, layout.thumbnailCount)
         }
 
         return 0

private let log = XCGLogger.defaultInstance()

private let ThumbnailIdentifier = "Thumbnail"

class Tile: Site {
    let backgroundColor: UIColor
    let trackingId: Int
    let wordmark: Favicon

    init(json: JSON) {
        let colorString = json["bgcolor"].asString!
        var colorInt: UInt32 = 0
        NSScanner(string: colorString).scanHexInt(&colorInt)
        self.backgroundColor = UIColor(rgb: (Int) (colorInt ?? 0xaaaaaa))
        self.trackingId = json["trackingid"].asInt ?? 0
        self.wordmark = Favicon(url: json["imageurl"].asString!, date: NSDate(), type: .Icon)

        super.init(url: json["url"].asString!, title: json["title"].asString!)

        self.icon = Favicon(url: json["faviconUrl"].asString!, date: NSDate(), type: .Icon)
    }
}

class SuggestedSitesData<T: Tile>: Cursor<T> {
    var tiles = [T]()

    init() {
        // TODO: Make this list localized. That should be as simple as making sure its in the lproj directory.
        var err: NSError? = nil
        let path = NSBundle.mainBundle().pathForResource("suggestedsites", ofType: "json")
        let data = NSString(contentsOfFile: path!, encoding: NSUTF8StringEncoding, error: &err)
        let json = JSON.parse(data as! String)

        for i in 0..<json.length {
            let t = T(json: json[i])
            tiles.append(t)
        }
    }

    override var count: Int {
        return tiles.count
    }

    override subscript(index: Int) -> T? {
        get {
            return tiles[index]
        }
    }
}

extension UIView {
    public class func viewOrientationForSize(size: CGSize) -> UIInterfaceOrientation {

    var profile: Profile
    var editingThumbnails: Bool = false

    init(profile: Profile, data: Cursor<Site>) {
        self.data = data
        self.profile = profile
