Update stage2 function
Bugs