Update addBook function from example.