init by book's official codes