Index: programs/mythfrontend/playbackbox.cpp
===================================================================
--- programs/mythfrontend/playbackbox.cpp	(revision 11370)
+++ programs/mythfrontend/playbackbox.cpp	(working copy)
@@ -1442,6 +1442,7 @@
 
 void PlaybackBox::listChanged(void)
 {
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- begin");
     if (playingSomething)
         return;
 
@@ -1450,10 +1451,12 @@
     update(drawTotalBounds);
     if (type == Delete)
         UpdateProgressBar();
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::listChanged() -- end");
 }
 
 bool PlaybackBox::FillList(bool useCachedData)
 {
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- begin");
     ProgramInfo *p;
 
     // Save some information so we can find our place again.
@@ -1607,6 +1610,7 @@
         titleIndex = 0;
         playList.clear();
 
+        VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 1");
         return 0;
     }
 
@@ -1888,6 +1892,7 @@
         }
     }
 
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::FillList() -- end 2");
     return (progCache != NULL);
 }
 
@@ -2415,6 +2420,8 @@
 
 void PlaybackBox::showDeletePopup(ProgramInfo *program, deletePopupType types)
 {
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- begin");
+
     freeSpaceNeedsUpdate = true;
 
     popup = new MythPopupBox(gContext->GetMainWindow(), drawPopupSolid,
@@ -2507,6 +2514,8 @@
     popup->ShowPopup(this, SLOT(doCancel())); 
 
     expectingPopup = true;
+
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::showDeletePopup() -- end");
 }
 
 void PlaybackBox::showAvailablePopup(ProgramInfo *rec)
@@ -3365,9 +3374,12 @@
 
 void PlaybackBox::doDelete(void)
 {
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- begin");
+
     if (!expectingPopup)
     {
         previewSuspend = false;
+        VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 1");
         return;
     }
 
@@ -3378,6 +3390,7 @@
     {
         showAvailablePopup(delitem);
         previewSuspend = false;
+        VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 2");
         return;
     }
 
@@ -3396,6 +3409,8 @@
     }
     else
         showDeletePopup(delitem, ForceDeleteRecording);
+
+    VERBOSE(VB_IMPORTANT, "PlaybackBox::doDelete() -- end 3");
 }
 
 void PlaybackBox::doForceDelete(void)
Index: programs/mythbackend/mainserver.cpp
===================================================================
--- programs/mythbackend/mainserver.cpp	(revision 11370)
+++ programs/mythbackend/mainserver.cpp	(working copy)
@@ -1004,9 +1004,14 @@
 
 void MainServer::HandleQueryRecordings(QString type, PlaybackSock *pbs)
 {
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- begin");
+
     MythSocket *pbssock = pbs->getSocket();
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- A");
     bool islocal = pbs->isLocal();
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- B");
     QString playbackhost = pbs->getHostname();
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- C");
 
     QString fs_db_name = "";
 
@@ -1015,7 +1020,11 @@
     RecIter ri;
     RecList schedList;
     if (m_sched)
+    {
+        VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- D");
         m_sched->getAllPending(&schedList);
+        VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- E");
+    }
 
     QString ip = gContext->GetSetting("BackendServerIP");
     QString port = gContext->GetSetting("BackendServerPort");
@@ -1025,12 +1034,16 @@
     QString inUseForWhat;
     QDateTime oneHourAgo = QDateTime::currentDateTime().addSecs(-61 * 60);
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- F");
     MSqlQuery query(MSqlQuery::InitCon());
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- G");
 
     query.prepare("SELECT DISTINCT chanid, starttime, recusage "
                   " FROM inuseprograms WHERE lastupdatetime >= :ONEHOURAGO ;");
     query.bindValue(":ONEHOURAGO", oneHourAgo);
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 0");
+
     if (query.exec() && query.isActive() && query.size() > 0)
         while (query.next())
         {
@@ -1049,6 +1062,7 @@
                 inUseMap[inUseKey] = inUseMap[inUseKey] | FL_INUSERECORDING;
         }
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 1");
 
     QString thequery =
         "SELECT recorded.chanid,recorded.starttime,recorded.endtime,"
@@ -1092,6 +1106,8 @@
 
     query.prepare(thequery);
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.0");
+
     if (!query.exec() || !query.isActive())
     {
         MythContext::DBError("ProgramList::FromRecorded", query);
@@ -1101,6 +1117,8 @@
     {
         outputlist << QString::number(query.size());
 
+        VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.1");
+
         while (query.next())
         {
             ProgramInfo *proginfo = new ProgramInfo;
@@ -1290,12 +1308,17 @@
 
             delete proginfo;
         }
+        VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 2.2");
     }
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- 3");
+
     for (ri = schedList.begin(); ri != schedList.end(); ri++)
         delete (*ri);
 
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- sending");
     SendResponse(pbssock, outputlist);
+    VERBOSE(VB_IMPORTANT, "MainServer::HandleQueryRecordings() -- end");
 }
 
 void MainServer::HandleFillProgramInfo(QStringList &slist, PlaybackSock *pbs)
Index: programs/mythbackend/scheduler.cpp
===================================================================
--- programs/mythbackend/scheduler.cpp	(revision 11370)
+++ programs/mythbackend/scheduler.cpp	(working copy)
@@ -76,7 +76,7 @@
     }
 }
 
-Scheduler::~Scheduler()
+static void delete_reclist(RecList &reclist)
 {
     while (reclist.size() > 0)
     {
@@ -86,6 +86,32 @@
     }
 }
 
+static void copy_reclist(RecList &copy, const RecList &orig)
+{
+    delete_reclist(copy);
+
+    RecList::const_iterator it = orig.begin();
+    for (; it != orig.end(); it++)
+        copy.push_back(new ProgramInfo(*(*it)));
+}
+
+Scheduler::~Scheduler()
+{
+    delete_reclist(reclist);
+
+    if (reclist_lock)
+    {
+        delete reclist_lock;
+        reclist_lock = NULL;
+    }
+
+    if (schedlist_lock)
+    {
+        delete schedlist_lock;
+        schedlist_lock = NULL;
+    }
+}
+
 void Scheduler::SetMainServer(MainServer *ms)
 {
     m_mainServer = ms;
@@ -263,42 +289,61 @@
 
 bool Scheduler::FillRecordList(void)
 {
-    QMutexLocker lockit(reclist_lock);
-
     schedMoveHigher = (bool)gContext->GetNumSetting("SchedMoveHigher");
     schedTime = QDateTime::currentDateTime();
 
-    VERBOSE(VB_SCHEDULE, "PruneOldRecords...");
-    PruneOldRecords();
-    VERBOSE(VB_SCHEDULE, "AddNewRecords...");
-    AddNewRecords();
-    VERBOSE(VB_SCHEDULE, "AddNotListed...");
-    AddNotListed();
+    RecList newlist;
+  
+    VERBOSE(VB_IMPORTANT, "PruneOldRecords...");
+    PruneOldRecords(newlist);
+    VERBOSE(VB_IMPORTANT, "AddNewRecords...");
+    AddNewRecords(dbConn, recordTable, specsched, threadrunning,
+                  *m_tvList, newlist);
+    VERBOSE(VB_IMPORTANT, "AddNotListed...");
+    AddNotListed(dbConn, recordTable, newlist);
+  
+    VERBOSE(VB_IMPORTANT, "Sort by time...");
+    newlist.sort(comp_overlap);
+    VERBOSE(VB_IMPORTANT, "PruneOverlaps...");
+    PruneOverlaps(newlist);
+  
+    VERBOSE(VB_IMPORTANT, "Sort by priority...");
+    newlist.sort(comp_priority);
+    VERBOSE(VB_IMPORTANT, "BuildListMaps...");
+  
+    RecList                retrylist;
+    QMap<int, RecList>     cardlistmap;
+    QMap<int, RecList>     recordidlistmap;
+    QMap<QString, RecList> titlelistmap;
+  
+    BuildListMaps(newlist, cardlistmap, recordidlistmap, titlelistmap);
 
-    VERBOSE(VB_SCHEDULE, "Sort by time...");
-    reclist.sort(comp_overlap);
-    VERBOSE(VB_SCHEDULE, "PruneOverlaps...");
-    PruneOverlaps();
+    VERBOSE(VB_IMPORTANT, "SchedNewRecords...");
+    SchedNewRecords(schedMoveHigher, newlist, retrylist,
+                    cardlistmap, recordidlistmap, titlelistmap);
+    VERBOSE(VB_IMPORTANT, "ClearListMaps...");
+    ClearListMaps(cardlistmap, recordidlistmap, titlelistmap);
 
-    VERBOSE(VB_SCHEDULE, "Sort by priority...");
-    reclist.sort(comp_priority);
-    VERBOSE(VB_SCHEDULE, "BuildListMaps...");
-    BuildListMaps();
-    VERBOSE(VB_SCHEDULE, "SchedNewRecords...");
-    SchedNewRecords();
-    VERBOSE(VB_SCHEDULE, "ClearListMaps...");
-    ClearListMaps();
+    VERBOSE(VB_IMPORTANT, "Sort by time...");
+    newlist.sort(comp_redundant);
+    VERBOSE(VB_IMPORTANT, "PruneRedundants...");
+    bool will_have_conflicts = PruneRedundants(newlist);
 
-    VERBOSE(VB_SCHEDULE, "Sort by time...");
-    reclist.sort(comp_redundant);
-    VERBOSE(VB_SCHEDULE, "PruneRedundants...");
-    PruneRedundants();
+    VERBOSE(VB_IMPORTANT, "Sort by time...");
+    newlist.sort(comp_recstart);
 
-    VERBOSE(VB_SCHEDULE, "Sort by time...");
-    reclist.sort(comp_recstart);
+    VERBOSE(VB_IMPORTANT, "UpdateNextRecord...");
+    UpdateNextRecord(dbConn, newlist);
 
-    VERBOSE(VB_SCHEDULE, "UpdateNextRecord...");
-    UpdateNextRecord();
+    {
+        VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locking");
+        QMutexLocker lockit(reclist_lock);
+        VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- locked");
+        copy_reclist(reclist, newlist);
+        hasconflicts = will_have_conflicts;
+    }
+    VERBOSE(VB_IMPORTANT, "Scheduler::FillRecordList() -- unlocked");
+    delete_reclist(newlist);
 
     return hasconflicts;
 }
@@ -479,7 +524,10 @@
     }
 }
 
-bool Scheduler::ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp)
+bool Scheduler::ChangeRecordingEnd(const bool specsched,
+                                   QMap<int, EncoderLink*> &tvList,
+                                   ProgramInfo *oldp,
+                                   ProgramInfo *newp)
 {
     RecordingType oldrectype = oldp->rectype;
     int oldrecordid = oldp->recordid;
@@ -500,7 +548,7 @@
         else
             return true;
     }
-    EncoderLink *tv = (*m_tvList)[oldp->cardid];
+    EncoderLink *tv = tvList[oldp->cardid];
     RecStatusType rs = tv->StartRecording(oldp);
     if (rs != rsRecording)
     {
@@ -590,7 +638,7 @@
     }
 }
 
-void Scheduler::PruneOldRecords(void)
+void Scheduler::PruneOldRecords(RecList &reclist)
 {
     RecIter dreciter = reclist.begin();
     while (dreciter != reclist.end())
@@ -610,7 +658,7 @@
     }
 }
 
-void Scheduler::PruneOverlaps(void)
+void Scheduler::PruneOverlaps(RecList &reclist)
 {
     ProgramInfo *lastp = NULL;
 
@@ -651,7 +699,10 @@
     }
 }
 
-void Scheduler::BuildListMaps(void)
+void Scheduler::BuildListMaps(RecList                &reclist,
+                              QMap<int, RecList>     &cardlistmap,
+                              QMap<int, RecList>     &recordidlistmap,
+                              QMap<QString, RecList> &titlelistmap)
 {
     RecIter i = reclist.begin();
     for ( ; i != reclist.end(); i++)
@@ -668,7 +719,9 @@
     }
 }
 
-void Scheduler::ClearListMaps(void)
+void Scheduler::ClearListMaps(QMap<int, RecList>     &cardlistmap,
+                              QMap<int, RecList>     &recordidlistmap,
+                              QMap<QString, RecList> &titlelistmap)
 {
     cardlistmap.clear();
     titlelistmap.clear();
@@ -698,7 +751,9 @@
     return false;
 }
 
-void Scheduler::MarkOtherShowings(ProgramInfo *p)
+void Scheduler::MarkOtherShowings(ProgramInfo *p,
+                                  QMap<int, RecList>     &recordidlistmap,
+                                  QMap<QString, RecList> &titlelistmap)
 {
     RecList *showinglist = &titlelistmap[p->title];
 
@@ -746,7 +801,7 @@
     }
 }
 
-void Scheduler::BackupRecStatus(void)
+void Scheduler::BackupRecStatus(RecList &reclist)
 {
     RecIter i = reclist.begin();
     for ( ; i != reclist.end(); i++)
@@ -756,7 +811,7 @@
     }
 }
 
-void Scheduler::RestoreRecStatus(void)
+void Scheduler::RestoreRecStatus(RecList &reclist)
 {
     RecIter i = reclist.begin();
     for ( ; i != reclist.end(); i++)
@@ -766,7 +821,10 @@
     }
 }
 
-bool Scheduler::TryAnotherShowing(ProgramInfo *p)
+bool Scheduler::TryAnotherShowing(QMap<int, RecList>     &cardlistmap,
+                                  QMap<QString, RecList> &titlelistmap,
+                                  QMap<int, RecList>     &recordidlistmap,
+                                  ProgramInfo *p)
 {
     PrintRec(p, "     >");
 
@@ -815,7 +873,7 @@
         }
 
         q->recstatus = rsWillRecord;
-        MarkOtherShowings(q);
+        MarkOtherShowings(q, recordidlistmap, titlelistmap);
         PrintRec(p, "     -");
         PrintRec(q, "     +");
         return true;
@@ -825,7 +883,12 @@
     return false;
 }
 
-void Scheduler::SchedNewRecords(void)
+void Scheduler::SchedNewRecords(const bool              schedMoveHigher,
+                                RecList                &reclist,
+                                RecList                &retrylist,
+                                QMap<int, RecList>     &cardlistmap,
+                                QMap<int, RecList>     &recordidlistmap,
+                                QMap<QString, RecList> &titlelistmap)
 {
     VERBOSE(VB_SCHEDULE, "Scheduling:");
 
@@ -834,7 +897,7 @@
     {
         ProgramInfo *p = *i;
         if (p->recstatus == rsRecording)
-            MarkOtherShowings(p);
+            MarkOtherShowings(p, recordidlistmap, titlelistmap);
         else if (p->recstatus == rsUnknown)
         {
             RecList &cardlist = cardlistmap[p->cardid];
@@ -842,7 +905,7 @@
             if (!FindNextConflict(cardlist, p, k))
             {
                 p->recstatus = rsWillRecord;
-                MarkOtherShowings(p);
+                MarkOtherShowings(p, recordidlistmap, titlelistmap);
                 PrintRec(p, "  +");
             }
             else
@@ -857,13 +920,19 @@
         i++;
         if (i == reclist.end() || lastpri != (*i)->recpriority)
         {
-            MoveHigherRecords();
+            MoveHigherRecords(schedMoveHigher, reclist, retrylist,
+                              cardlistmap, recordidlistmap, titlelistmap);
             retrylist.clear();
         }
     }
 }
 
-void Scheduler::MoveHigherRecords(void)
+void Scheduler::MoveHigherRecords(const bool              schedMoveHigher,
+                                  RecList                &reclist,
+                                  RecList                &retrylist,
+                                  QMap<int, RecList>     &cardlistmap,
+                                  QMap<int, RecList>     &recordidlistmap,
+                                  QMap<QString, RecList> &titlelistmap)
 {
     RecIter i = retrylist.begin();
     for ( ; i != retrylist.end(); i++)
@@ -874,21 +943,22 @@
 
         PrintRec(p, "  ?");
 
-        if (TryAnotherShowing(p))
+        if (TryAnotherShowing(cardlistmap, titlelistmap, recordidlistmap, p))
             continue;
 
-        BackupRecStatus();
+        BackupRecStatus(reclist);
         p->recstatus = rsWillRecord;
-        MarkOtherShowings(p);
+        MarkOtherShowings(p, recordidlistmap, titlelistmap);
 
         RecList &cardlist = cardlistmap[p->cardid];
         RecIter k = cardlist.begin();
         for ( ; FindNextConflict(cardlist, p, k); k++)
         {
             if ((p->recpriority < (*k)->recpriority && !schedMoveHigher) ||
-                !TryAnotherShowing(*k))
+                !TryAnotherShowing(cardlistmap, titlelistmap,
+                                   recordidlistmap, *k))
             {
-                RestoreRecStatus();
+                RestoreRecStatus(reclist);
                 break;
             }
         }
@@ -898,10 +968,10 @@
     }
 }
 
-void Scheduler::PruneRedundants(void)
+bool Scheduler::PruneRedundants(RecList &reclist)
 {
     ProgramInfo *lastp = NULL;
-    hasconflicts = false;
+    bool hasconflicts = false;
 
     RecIter i = reclist.begin();
     while (i != reclist.end())
@@ -951,9 +1021,12 @@
             i = reclist.erase(i);
         }
     }
+
+    return hasconflicts;
 }
 
-void Scheduler::UpdateNextRecord(void)
+void Scheduler::UpdateNextRecord(MSqlQueryInfo &dbConn,
+                                 RecList       &reclist)
 {
     QMap<int, QDateTime> nextRecMap;
     QDateTime now = QDateTime::currentDateTime();
@@ -1043,57 +1116,27 @@
 {
     QMutexLocker lockit(reclist_lock);
 
-    while (retList->size() > 0)
-    {
-        ProgramInfo *pginfo = retList->back();
-        delete pginfo;
-        retList->pop_back();
-    }
-
-    RecIter i = reclist.begin();
-    for (; i != reclist.end(); i++)
-    {
-        ProgramInfo *p = *i;
-        retList->push_back(new ProgramInfo(*p));
-    }
+    copy_reclist(*retList, reclist);
     retList->sort(comp_timechannel);
 }
 
 void Scheduler::getAllPending(QStringList &strList)
 {
-    QMutexLocker lockit(reclist_lock);
+    RecList retList;
+    getAllPending(&retList);
 
     strList << QString::number(hasconflicts);
-    strList << QString::number(reclist.size());
+    strList << QString::number(retList.size());
 
-    RecList *retList = new RecList;
+    for (RecIter it = retList.begin(); it != retList.end(); ++it)
+        (*it)->ToStringList(strList);
 
-    RecIter i = reclist.begin();
-    for (; i != reclist.end(); i++)
-    {
-        ProgramInfo *p = *i;
-        retList->push_back(new ProgramInfo(*p));
-    }
-    retList->sort(comp_timechannel);
-
-    for (i = retList->begin(); i != retList->end(); i++)
-    {
-        ProgramInfo *p = *i;
-        p->ToStringList(strList);
-        delete p;
-    }
-
-    delete retList;
+    delete_reclist(retList);
 }
 
 RecList *Scheduler::getAllScheduled(void)
 {
-    while (schedlist.size() > 0)
-    {
-        ProgramInfo *pginfo = schedlist.back();
-        delete pginfo;
-        schedlist.pop_back();
-    }
+    delete_reclist(schedlist);
 
     findAllScheduledPrograms(schedlist);
 
@@ -2008,7 +2051,12 @@
     VERBOSE(VB_SCHEDULE, " +-- Done.");
 }
 
-void Scheduler::AddNewRecords(void) 
+void Scheduler::AddNewRecords(MSqlQueryInfo           &dbConn,
+                              const QString           &recordTable,
+                              const bool               specsched,
+                              const bool               threadrunning,
+                              QMap<int, EncoderLink*> &tvList,
+                              RecList                 &reclist) 
 {
     struct timeval dbstart, dbend;
 
@@ -2022,8 +2070,8 @@
     int ccpriority      = gContext->GetNumSetting("CCRecPriority", 0);
 
     QMap<int, bool> cardMap;
-    QMap<int, EncoderLink *>::Iterator enciter = m_tvList->begin();
-    for (; enciter != m_tvList->end(); ++enciter)
+    QMap<int, EncoderLink *>::Iterator enciter = tvList.begin();
+    for (; enciter != tvList.end(); ++enciter)
     {
         EncoderLink *enc = enciter.data();
         if (enc->IsConnected())
@@ -2333,7 +2381,9 @@
                     r->recendts != p->recendts &&
                     (r->recordid == p->recordid ||
                      p->rectype == kOverrideRecord))
-                    ChangeRecordingEnd(r, p);
+                {
+                    ChangeRecordingEnd(specsched, tvList, r, p);
+                }
                 delete p;
                 p = NULL;
                 break;
@@ -2390,8 +2440,10 @@
         reclist.push_back(*tmp);
 }
 
-void Scheduler::AddNotListed(void) {
-
+void Scheduler::AddNotListed(MSqlQueryInfo &dbConn,
+                             const QString &recordTable,
+                             RecList       &reclist)
+{
     struct timeval dbstart, dbend;
     RecList tmpList;
 
Index: programs/mythbackend/scheduler.h
===================================================================
--- programs/mythbackend/scheduler.h	(revision 11370)
+++ programs/mythbackend/scheduler.h	(working copy)
@@ -49,7 +49,7 @@
     RecList *getConflicting(ProgramInfo *pginfo);
 
     void PrintList(bool onlyFutureRecordings = false);
-    void PrintRec(ProgramInfo *p, const char *prefix = NULL);
+    static void PrintRec(ProgramInfo *p, const char *prefix = NULL);
 
     bool HasConflicts(void) { return hasconflicts; }
 
@@ -66,50 +66,80 @@
     static void *SchedulerThread(void *param);
 
   private:
-    QString recordTable;
-
     void verifyCards(void);
 
     bool FillRecordList(void);
     void UpdateMatches(int recordid);
     void UpdateManuals(int recordid);
-    void PruneOldRecords(void);
-    void AddNewRecords(void);
-    void AddNotListed(void);
     void BuildNewRecordsQueries(int recordid, QStringList &from, QStringList &where,
                                 MSqlBindings &bindings);
-    void PruneOverlaps(void);
-    void BuildListMaps(void);
-    void ClearListMaps(void);
-    bool FindNextConflict(RecList &cardlist, ProgramInfo *p, RecIter &iter);
-    void MarkOtherShowings(ProgramInfo *p);
-    void MarkShowingsList(RecList &showinglist, ProgramInfo *p);
-    void BackupRecStatus(void);
-    void RestoreRecStatus(void);
-    bool TryAnotherShowing(ProgramInfo *p);
-    void SchedNewRecords(void);
-    void MoveHigherRecords(void);
-    void PruneRedundants(void);
-    void UpdateNextRecord(void);
 
-    bool ChangeRecordingEnd(ProgramInfo *oldp, ProgramInfo *newp);
-
     void findAllScheduledPrograms(list<ProgramInfo *> &proglist);
     bool CheckShutdownServer(int prerollseconds, QDateTime &idleSince,
                              bool &blockShutdown);
     void ShutdownServer(int prerollseconds);
 
+    // statics
+    static void PruneOldRecords(RecList               &reclist);
+    static void AddNewRecords(MSqlQueryInfo           &dbConn,
+                              const QString           &recordTable,
+                              bool                     specsched,
+                              bool                     threadrunning,
+                              QMap<int, EncoderLink*> &tvList,
+                              RecList                 &reclist);
+    static void AddNotListed(MSqlQueryInfo            &dbConn,
+                             const QString            &recordTable,
+                             RecList                  &reclist);
+    static void PruneOverlaps(RecList                 &reclist);
+    static void BuildListMaps(RecList                 &reclist,
+                              QMap<int, RecList>      &cardlistmap,
+                              QMap<int, RecList>      &recordidlistmap,
+                              QMap<QString, RecList>  &titlelistmap);
+    static void ClearListMaps(QMap<int, RecList>      &cardlistmap,
+                              QMap<int, RecList>      &recordidlistmap,
+                              QMap<QString, RecList>  &titlelistmap);
+    static bool FindNextConflict(RecList                   &cardlist,
+                                 ProgramInfo               *p,
+                                 RecIter                   &iter);
+    static void MarkOtherShowings(ProgramInfo              *p,
+                                  QMap<int, RecList>       &recordidlistmap,
+                                  QMap<QString, RecList>   &titlelistmap);
+    static void MarkShowingsList(RecList                   &showinglist,
+                                 ProgramInfo               *p);
+    static void BackupRecStatus(RecList                    &reclist);
+    static void RestoreRecStatus(RecList                   &reclist);
+    static bool TryAnotherShowing(QMap<int, RecList>       &cardlistmap,
+                                  QMap<QString, RecList>   &titlelistmap,
+                                  QMap<int, RecList>       &recordidlistmap,
+                                  ProgramInfo              *p);
+    static void SchedNewRecords(bool                        schedMoveHigher,
+                                RecList                    &reclist,
+                                RecList                    &retrylist,
+                                QMap<int, RecList>         &cardlistmap,
+                                QMap<int, RecList>         &recordidlistmap,
+                                QMap<QString, RecList>     &titlelistmap);
+    static void MoveHigherRecords(bool                      schedMoveHigher,
+                                  RecList                  &reclist,
+                                  RecList                  &retrylist,
+                                  QMap<int, RecList>       &cardlistmap,
+                                  QMap<int, RecList>       &recordidlistmap,
+                                  QMap<QString, RecList>   &titlelistmap);
+    static bool PruneRedundants(RecList                    &reclist);
+    static void UpdateNextRecord(MSqlQueryInfo             &dbConn,
+                                 RecList                   &reclist);
+    static bool ChangeRecordingEnd(bool                     specsched,
+                                   QMap<int, EncoderLink*> &tvList,
+                                   ProgramInfo             *oldp,
+                                   ProgramInfo             *newp);
 
+  private:
+    QString recordTable;
     QValueList<int> reschedQueue;
     QMutex reschedLock;
     QMutex recordmatchLock;
     QWaitCondition reschedWait;
     RecList reclist;
-    RecList retrylist;
     RecList schedlist;
-    QMap<int, RecList> cardlistmap;
-    QMap<int, RecList> recordidlistmap;
-    QMap<QString, RecList> titlelistmap;
 
     QMutex *reclist_lock;
     QMutex *schedlist_lock;
