update with the new files, adding database foreign key handling