Fixed nested loop to display better