Exercise 2 - correct handling of empty list