Improved the save_limited_by_size function, fixed selection of key values, added sample size limit and  added summary report