More functions from Exercise 5