Solution for the exercises