finish refactoring and add mating/mutation