refactor variant stat generation function to make it more accessible