code from Tutorial 14 and 15 paragraphs 1-5