optimizing code part3