working version assignment2