     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ChapterNumCell",
-                                                      for: indexPath as IndexPath)
+                                                      for: indexPath as IndexPath) as! ChapterNumCell
         let chapter = indexPath.row + 1
-        let label = UILabel(frame: CGRect(x: 0, y: 0, width: self.size, height: self.size))
-        label.textAlignment = .center
-        label.text = String(chapter)
-        label.textColor = UIColor(red: 0.24, green: 0.5, blue: 0.96, alpha: 1.0)
-        
-        label.bounds = CGRect(x: 0.0, y: 0.0, width: self.size, height: self.size)
-        label.layer.cornerRadius = self.size / 2
-        label.layer.borderWidth = 2.0
-        label.layer.borderColor = UIColor.init(white: 0.8, alpha: 1.0).cgColor
+        cell.label.text = String(chapter)
         let lastRef = HistoryModel.shared.current()
         if lastRef.bookId == self.book.bookId && lastRef.chapter == chapter {
             let alpha = AppFont.nightMode ? 0.3 : 1.0
-            label.backgroundColor = UIColor(red: 0.89, green: 0.98, blue: 0.96, alpha: CGFloat(alpha))
-            label.layer.masksToBounds = true
+            cell.label.backgroundColor = UIColor(red: 0.89, green: 0.98, blue: 0.96, alpha: CGFloat(alpha))
+            cell.label.layer.masksToBounds = true
         }
-        cell.contentView.addSubview(label)
         return cell
     }
     

    }
}


    }
    
    private let book: Book
    
    init(book: Book) {
        self.book = book
