Added ExitFlagSet function in controller