Separate legacy code into new file, and fallback so that all old tests pass.