Updated printList() after improving on it in Exercise 5.