got it working (or part of it)
updated to latest output format
make more readable in the book