loops for generating columns