added functionality to prepare all fetched data for insert (insert scripts remaining to achieve full functionality)