modified to use foreign key statement