Huge refactoring, changed way of choosing algorithm to compute.