added foreach loop on books array