Final solution for assignment 1