Proving that the Quotient of an Algebraic Curve $X/G$ is an Algebraic Curve.

I am self-studying Miranda's book Algebraic Curves and Riemann Surfaces and I am looking for a hint for a problem. For those with the book, it is on page 178, and is Problem VI.$$1$$.L. The problem is the following:

Let $$G$$ be a finite group acting effectively on an algebraic curve $$X$$.

(i) Show that $$G$$ acts on the function field $$\mathcal{M}(X)$$.

(ii) Show that the function field of the quotient Riemann surface $$X/G$$ is the field of invariants $$\mathcal{M}(X)^G$$.

(iii) Show that $$X/G$$ is an algebraic curve.

Parts (i) and (ii) I found rather easy, so that for part (iii) I have $$\mathcal{M}(X)^G\cong \mathcal{M}(X/G)$$. According to Miranda, an algebraic curve is a compact Riemann surface $$X$$ so that $$\mathcal{M}(X)$$ separates points and separates tangents. So, I am trying to demonstrate that $$\mathcal{M}(X)^G$$ separates points on $$X/G$$.

Now, by assumption $$\mathcal{M}(X)$$ separates points on $$X$$, the issue however is finding a function $$f\in \mathcal{M}(X)^G$$ separating points $$x$$ and $$y$$ lying in distinct $$G$$-orbits. I tried fixing $$f\in \mathcal{M}(X)$$ such that $$f(x)\ne f(y)$$. Then I produced a $$G$$-invariant function $$\overline{f}$$ by $$\overline{f}=\frac{1}{\lvert G\rvert}\sum_{g\in G} f\circ g$$ where I identify $$G$$ with a subgroup of $$\operatorname{Aut}(X)$$. I suspect I might be able to show that this function has the desired property, but I have not succeeded. I am having similar difficulties with separation of tangents.

I think $$\overline f$$ has no reason to separate $$x$$ from $$y$$ since there might be some cancellations.
However here is an easy way to separe them : by Lemma 1.13 from the same chapter, for any finite set of points $$q_i$$ and another point $$p$$ there is a function $$f$$ with a pole at $$p$$ and a zero at each $$q_i$$. We pick a function with a pole at $$y$$ and a zero at $$G \cdot x \cup G\cdot y \backslash\{y\}.$$ This way, $$\overline f$$ certainly has a pole at $$G \cdot y$$ and a zero at $$G \cdot x$$.
The argument is similar for separating tangents : let $$x \in X$$. There is a function with a pole of order $$1$$ at $$x$$ since $$X$$ is an algebraic curve. By adding suitable functions we can also assume that $$f$$ is zero on $$G \cdot x \backslash \{x\}$$. Now it is clear that $$\overline f$$ separates tangents at $$G \cdot x$$.