Modified assignment from book.