Solution for I.1.5. part 2 v1 - not the best solution