code for semester, not tested yet