Use new database API throughout