Spivak's Calculus, Chapter 6 problem 16 d) I don't understand how to solve this problem and the official solution does not make much sense to me either.
The problem is:

(d) Let $f$ be a function with the property that every point of discontinuity is a removable discontinuity. This means that $\lim_{y\to x}f(y)$ exists for all $x$, but $f$ may be discontinous at some (even infinetely many) numbers $x$. Define $g(x) = \lim_{y\to x}f(y)$. Prove that $g$ is continous.

The official solution is:

Since $g(a) = \lim_{y\to a}f(y)$, by definition, it follows that for any $\varepsilon>0$ there is a $\delta>0$ such that $|f(y)-g(a)|<\varepsilon$ for $|y-a|<\delta$. This means that
  $$
g(a)-\varepsilon<f(y)<g(a)+\varepsilon
$$
  for $|y-a|<\delta$. So if $|x-a|<\delta$, we have 
  $$
g(a)-\varepsilon \leq \lim_{y\to x}f(y) \leq g(a)+\varepsilon
$$
  which shows that $|g(x)-g(a)|\leq\varepsilon$ for all $x$ satisfying $|x-a|<\delta$. Thus $g$ is continous at $a$.

I don't understand how saying that $|x-a|<\delta$ impliest that $g(a)-\varepsilon \leq \lim_{y\to x}f(y) \leq g(a)+\varepsilon$.
When I was trying to come up with my own solution the thing that bothered me that if a lot of values of $f(x)$ are changed (so that they are equal to $\lim_{x\to a}f(x)$) then this may in fact change the limit of some other points? I then tried to say that for some $\delta>0$ the values for $x$ in $0<|x-a|<\delta$ the values would stay the same, however I think that for a functions such as one where $f(x) = 0$ if $x$ is irrational and $f(x) = \frac{1}{q}$ if $x=\frac{p}{q}$ in lowest terms, this would not be true. Where did I go wrong?
 A: If $|x-a|<\delta$, then the $y$'s approaching $x$ also satisfy $|y-a|<\delta$, if $y$ is close enough to $x$. So the first inequeality applies to all these $y$'s close enough and then also to its limit.
A: After reading the answeres posted by other users here and trying to solve the problem on my own again I finally understand this question (and the answer). However since the answer I came up with is very extensive and maybe approaches the problem from another angle (although all conclusions are the same), which may help other who also have the problem with this question I will post it anyways:
First we will prove that changing the values of $f(x)$ to $\lim\limits_{x\to a}f(x)$ (at those points where $f$ has a removable discontinuity) does not change $\lim\limits_{x\to y}$ at any other point. Let's say that at $\lim\limits_{x\to a}f(x) = l$. Now this means that if we pick any $\varepsilon>0$ we have some $\delta>0$ such that for all $x$ if $0<|x-a|<\delta$, then $|f(x)-l|<\varepsilon$, which means that
\begin{equation*}
l-\varepsilon<f(x)<l+\varepsilon
\end{equation*}
Now let's say that we have some $y$, such that $0<|y-a|<\delta$, at which we have a removable discontinuity, so  $\lim\limits_{x\to y}f(x) \neq f(y)$. Let's now redefine $f$ such that $f(y) = \lim\limits_{x\to y}f(x)$. If we assume, for sake of contradiction, that now $f(y)>l+\varepsilon$, this means (as $f$ is now continous at $y$), that for some $\delta'$ we have $f(x)>l+\varepsilon$ for all $x$ if $|x-y|<\delta'$ . (This is a slight extension of Theorem 3, which say that if $f(a) > 0$ and $f$ is continous at $a$, then there there is $\delta_1>0$, such that $f(x)>0$ for all $x$ satisfying $0\leq |x-a|<\delta_1$ ). Similarly if we say that $f(y) < l-\varepsilon$. However, this is a contradiction, since if $x\neq y$ the value of $f(x)$ for $x$ such that $0<|x-a|<\delta$ does not change, so we should have $l-\varepsilon<f(x)<l+\varepsilon$ if $x\neq y$. Therefore we can only have 
\begin{equation*}
l-\varepsilon\leq f(y)\leq l+\varepsilon.
\end{equation*}
So this means that after we "fix" the removable discontinuities (so our new function is $g(x)$) we have for every $\varepsilon>0$ a $\delta>0$, such that for all $x$ if $0<|x-a|<\delta$, then $|g(x)-\lim\limits_{x\to a}f(x)|\leq\varepsilon$, which is a valid definition of a limit (also accoring to Problem 25 in chapter 5)! So for every $a$ we have 
\begin{equation*}
\lim\limits_{x\to a}f(x) = \lim\limits_{x\to a}g(x) = g(a),
\end{equation*}
therefore $g(x)$ is continous for all $x$. $\blacksquare$
