Move core implementations to core.cpp

Code move only - no semantics changes.