Further refactoring, especially to genetic algorithm first pass.