made large improvements to the scheduling algorithm, and changed shift_id back to shift_type in database