refactoring of eat and giveBirth