Fixed the nested loop, and errors for grading