My sample solution for a class assignment