My solution for the example assignment