Improved exercise 4 for readability