solution to the example!!