Split calculation to 2 algorithms.