course_spent_time function (and subfunctions) added