Improved managed tasks logic