following the examples from the above book