Optimize the makeBookSets method