Trying to implement the examples of the book