final version of assignment2 M.Savard