Added loggedInAsTeacher middleware