Solution for the assignment