#CourseType fix and some code cleaning