added for()-loop code