Added a helper function to handle dynamic stat changes