Encapsulated generate - save functions to reduce RAM requirements.