For months he had plotted to kill at least 30 children and two teachers.