First attempt at exercise 2