Possible solution for the exercise