first attempt to solve section 5.12 and related problems