Move core implementations to core.cpp