Added clearPatientDetail() method and guarding ifs.