a better structure for handle files asynchronously