changing control flow of for loop
corrected seg fault. the lines, however, do not print.