fix bug 845890 - fix demo counts for staff users
(some) code cleanup
Merge pull request #905 from groovecoder/demo-totals-845890

fix bug 845890 - fix demo counts for staff users