Refactor Logic.updateTask() to make it neater