changes to the cms scripts

from DVHealth.
Mostly switching to Database::db