Changed printList function definition