merging code to choose hash based on is_teacher