further optimization of educate function