Code for Assignment 8