Implement teacher sorting