Moved parts from core to extensions.
Fixed test.