Small refactoring to task handlers