implementing ch 5.3 compleat