improve mainTask control