Refactored packages.py into classes