modified to fit new db schema