added code for assignment2