exercise 5.11 unfold implemented