$d(f(x),f(y))\leq\varphi(d(x,y))$ if and only if $f$ is uniformly continuous 
Let $\varphi:[0,+\infty)\rightarrow[0,\infty)$ an increasing function, continuous at $0$ and such that $\varphi(0)=0$. A function $f:M\rightarrow N$ is said to admit $\varphi$ as a "continuity module" when $d(f(x),f(y))\leq\varphi(d(x,y))$ for any $x,y\in M$ . Prove that $f:M\rightarrow N $ is uniformly continuous if and only if it admits some $\varphi$ as a "continuity module".

I'll put here where i could go so far:
$\Longrightarrow:$ given $\epsilon>0$, there exists $\delta>0$ such that $d(x,y)<\delta$ implies $d(f(x),f(y))<\epsilon$ for any $x,y\in M$. Now we construct such a $\varphi$. We must define it increasing and such that for $x\in[0,\delta)$ $\varphi(x)<\epsilon$. But i couldn't think of a good and clear construction.
$\Longleftarrow$: Let $\varphi$ a "continuity module" for $f$. We analyse two cases: $f$ is bounded and not.
$i)$ if $f$ is bounded, then the condition: $d(f(x),f(y))\leq\varphi(d(x,y))$ implies that $\varphi([0,\infty))$ must be unbounded too. Hence, $\varphi$ is surjective and given $\epsilon>0$  one can find $\delta\in[0,\infty)$ such that $\varphi(\delta)=\epsilon.$ Therefore, if $d(x,y)<\delta$ by the fact that $\varphi$ is inreasing, for any $d(x,y)<\delta$ we conclude that $d(f(x),f(y))\leq \varphi( d(x,y))<\varphi(\delta)=\epsilon.$
$ii)$ now if $f$ is bounded, i really dunno how to proceed. When i was thinking about this exercise i was considering the supremum of $f(M)$, but $M$ is a metric space. So this quite does not make sense.
That's all i could come up. Any help would be appreciated.
 A: For the forward direction, consider $\varphi:[0,\infty)\rightarrow[0,\infty)$ defined by $$\varphi(\delta)=\inf\{\varepsilon\geq 0:d(f(x),f(y))\leq \varepsilon\,\forall x,y\in M\text{ s.t. }d(x,y)\leq\delta\}.$$ This is always finite, since by uniform continuity, $f$ is bounded on bounded sets. Also, given $\delta<\delta',$ $$\{\varepsilon\geq 0:d(f(x),f(y))\leq\varepsilon\,\forall x,y\in M\text{ s.t. }d(x,y)\leq\delta\}\supseteq\{\varepsilon\geq0:d(f(x),f(y))\leq\varepsilon\,\forall x,y\in M\text{ s.t. }d(x,y)\leq\delta'\},$$ so $\varphi(\delta)\leq\varphi(\delta'),$ which proves that $\varphi$ is increasing. Clearly $\varphi(0)=0,$ since $d(x,y)=0$ if and only if $x=y,$ whence it follows that $f(x)=f(y),$ so $d(f(x),f(y))=0.$ Finally, given $\varepsilon>0,$ by uniform continuity, there is some $\bar{\delta}>0$ such that for all $0<\delta<\bar{\delta},$ $\varphi(\delta)\leq\varepsilon.$ This proves the continuity of $\varphi$ at 0. Finally, $\varphi$ satisfies the "continuity module" condition for $f$ by definition.
For the reverse direction, by continuity of $\varphi$ at $0$, given $\varepsilon>0,$ there is some $\delta>0$ such that $\varphi(\delta)<\varepsilon.$ Then whenever $d(x,y)<\delta,$ using the fact that $\varphi$ is increasing, $d(f(x),f(y))\leq\varphi(d(x,y))\leq\varphi(\delta)<\varepsilon,$ which gives uniform continuity of $f.$
