Update legacy module for the new core API.
Include unit tests for legacy module.