Refactoring and adding new functions for animal.