rewrite to async work with json files