code refactoring. Moved subscribe_all and unsubscribe_all to tasks