looping over samples