refactored updatePatient