Small refactoring in thor task