Ensemble optimization implemented, seems to work.