modified core.py