Added cleanup so that linked data is deleted