Finished code for Activity 1.4.2