first part of chapter on recursion implemented