added foreach loop that logged book info