ODE for mixing problem 
A jar of hot water is in a sink, and we are pouring water into the jar with a rate of $a$ gallons per minute. The water spills over the jar at a rate of $a$ gallons per minute after being thoroughly mixed. Write the ODE for $x(t),$ where the $x(t)$ is the temperature of water in the jar at time $t$.

I am having trouble interpreting the temperature into the ODE. 
What I know is that $x'(t)$ equals the input rate minus the output rate, and in this problem, I'm writing the output as:
$$a\frac{x(t)}{N}$$
where $N$ is how much gallon of water the jar is able to contain. I have no idea about the input rate because should we not multiply the rate $a$ by the current temperature? Is it $x(t)$?

My attempt. 
Over a period of time $\Delta t$, a quantity $a \Delta t$ will flow to the jar, from the source at temperature $T_{source}$. The jar has volume $L$, and for simplicity I define $n = L / a \Delta t$. 
Assuming that the updated temperature is just a (volume)-weighted average, the updated temperature $T_1$ will read
$$ T_1 = \frac{n T_0 + T_{source}}{n+1}$$
Where $T_0$ stands fort the temperature before the quantity of fluid is added.
The temperature difference $\Delta T = T_1 – T_0$ equals then
$$ \Delta T  = \frac{T_{source} – T_0}{n+1}$$ 
In the limit $\Delta t \to 0$, $$  \frac{(T_{source} – T_0) a \Delta t}{L } $$
  $$ \frac{\Delta T } {\Delta t} = \dot{T}$$
And one recovers the ODE
$$ \dot{T} = \frac{(T_{source} - T)a}{L}$$
The larger the jar, the slower the temperature change, as one would expect. The cooler the temperature at the inlet, the faster the change. 
