use correct loop teqnique for arrays