FINAL CODE
FINAL CODE FOR PHASE