use flatmap to await for the futures to complete