solution for exercise 1