little refactoring of sub tasks code