implemented book- and chapter-guessing logic