imported code for Assignment 1