re-worked algorithms chapter