Add refresh counter logic to populate.js