not working textbook code