solution to one of the exercises