Refactored common operations from course.py and library.py into superclass