Solution for assignment 5