solve exercises 4.31 - 4.34