safer method of iterating