Adding code for Homework 7