Code for phase1
Fixed merge conflicts