Small change on the order of the DELETE statements, to respect foreign keys constraints