Improved memory usage in course duplication