Update Main code

FINAL