divided searchbook function into 3 separate functions as specified by TA on piazza