Moved code common between teacher and student to common.js