helper function to update animal