added code for assignment 2