the function now saves all patient's data.