Basis with diameter tending $0$ separable metric space

I'm reading a book of Ergodic Theory and in a proof of certain result I've found a fact I don't understand how to explain. The text assures that for any separable metric space there exists a countable basis of open sets $\{U_n\}$ whose diameters satisfy $\lim_{n\rightarrow \infty} \mbox{diam} (U_n)=0$. Any idea about how to assure this property for the diameters of the countable basis? Thanks.

• There's an obvious way to do it if the metric space is $\sigma$-compact, or $\sigma$-totally bounded. Let $X=\bigcup_n X_n$ where each $X_n$ is totally bounded, and $X_1\subseteq X_2\subseteq\cdots.$ For each $n$ choose a finite cover of $X_n$ with open sets of diameter $\lt1/n$ and take the union. Don't see how to do it with just a separable metric space. – bof Sep 15 '17 at 22:53

Let $\{x_n: n ∈ ω\}$ be a dense set. Let $U_{n, m} := B(x_n, \frac{1}{m})$, i.e. the open ball of radius $\frac{1}{m}$. Clearly, $\{U_{n, m}: n, m ∈ ω\}$ is a countable base. Moreover, $\{U_{n, m}: m ≥ n ∈ ω\}$ is also a countable base, and this one has diameters converging to $0$ since for every $k$ only sets $U_{n, m}$ with $n ≤ m ≤ k$ may have diameter $> \frac{2}{k}$.