Extracted add new task function