my solution to the assignment