Track running threads

Also has a fix for promises