The code I found for this in a book does not work. Can you help me?