Added logic to handle instances where the book does not exist