working version of Assignment 2