Updated algorithm implementation. Incorporated breeding phase.