record bin counts in count column
calculate bin positions
actually use position column variable
use correct loop variable