Algorithm implementation.