Updated function for dynamicScheduler.