added onEaten generic function