refactor callback for populate files