Moved algorithm implementation to AlgorithmFactory.