Fixed task order in refactored method