Add NewTask func; Improved task ID error handling