final version of assignment2