Refactor main.c

Change main.c according to project's coding guideline.