the code now actually works with the new data model