using resolve to avoid asynchronous display of dat