added forloop in the main class