Fixed class TaskManager.

Added tasks is now removed when they're not active. Active tasks are now
able to produce new tasks which are added to the active tasks list.