Code for Stage3