added second logic to sample39