Implementing proper "task tree". Fixes #3.