modified for the new database schema