My solution for this assignment