Updated main with comments