solved exercises 12 and 13.