Added the flag check in main