             } else if self.currentdaymonth(index: index) {
                 self.snapshotsloggdata?.snapshotslogs![index].setValue(1, forKey: "selectCellID")
             } else {
-                if self.keepallselcteddayofweek == true {
-                    if self.previousmonthskeepAllselecteddayofweek(index: index) {
-                        self.snapshotsloggdata?.snapshotslogs![index].setValue(1, forKey: "selectCellID")
-                    }
-                } else {
-                    if self.previousmonthskeepLastselecteddayofweek(index: index) {
-                        self.snapshotsloggdata?.snapshotslogs![index].setValue(1, forKey: "selectCellID")
-                    }
+                if self.keepallorlastdayinweek(index: index) {
+                    self.snapshotsloggdata?.snapshotslogs![index].setValue(1, forKey: "selectCellID")
                 }
             }
         }

        return false
    }

    // Keep snapshots last selected day every previous months
    private func previousmonthskeepLastselecteddayofweek(index: Int) -> Bool {
        let datesnapshotstring = (self.snapshotsloggdata!.snapshotslogs![index].value(forKey: "dateExecuted") as? String)!
        let month = self.datefromstring(datestringlocalized: datesnapshotstring).monthNameShort()
        let day = self.datefromstring(datestringlocalized: datesnapshotstring).dayNameShort()

            self.datecomponentsfromstring(datestringlocalized: self.now).month ||
            self.datecomponentsfromstring(datestringlocalized: datesnapshotstring).year! <
            self.datecomponentsfromstring(datestringlocalized: self.now).year! {
            if check!(self.datefromstring(datestringlocalized: datesnapshotstring)) == true {
                if self.datecomponentsfromstring(datestringlocalized: datesnapshotstring).month == self.datecomponentsfromstring(datestringlocalized: self.now).month! - 1 {
                    let tag = NSLocalizedString("Keep", comment: "plan")  + " " + day + ", " + month + " " + NSLocalizedString("previous month", comment: "plan")
                    self.snapshotsloggdata?.snapshotslogs![index].setValue(tag, forKey: "period")
