solve exercises 6.22, 6.34