copy from CourseMirror