Ading the phase3 code
Adding the complete changes