finished code for tutorial04.txt