housecleaning and helper function to save arbitrary data