solve exercises 6.23 - 6.27