add function to save into file