Changed trimester calculation, fixing bugs in the process