Added code from the book as a basis for future development