Extract common parts to core.