Solution for the assignment2