Completed exercises 3.12 and 3.13