added else statement for for loops