updated to work with new table schema