Refactored common code to common.py; fixed category name for non-free media