now added primary key logic