Bug #3917 CountTable is deprecated

I am also removing dead code (some of it was using CountTables).