init solution to book's problem