Use CourseKey and clearer logic