Restructure into nicer API for replacement algos