convert for to foreach and so on...