Refactor searchBooks and getBookData methods (encapsulation).