moved output after for loop