Refactored some of the cookbook copying code