Solution for assignment 2