Add production counting code