final version for assignment2