Exercise 5.3, second pass, added user input