New version of core.py