perfect the new patient function