replace more SQL with call to ::DB