Rewrite get_domain_stats_data function

@nickpell