Use backward algorithm in stats
Fix stats hierarchy

Merge all contiguous intervals for stats. Set span's parent of timers to the waiting task.