refactored CourseCard code