refactor with async