Code optimization for the teachers view