Fixed table to use new db query