moved setter out of loop