added part3 code