moved sampling to bin_data