Exercise 1.7: Fixed bug (bad indices).