refactoring code in taskList