solved exercises 1.16 - 1.18