updated data model to handle updates and deletes correctly