Moved code out of core.py into plugin-specific files