For a compact subset K of a Riemann surface, necessary and sufficient conditions are given for a function algebra containing A(K) to be all of C(K). Using these results, several conditions are given on a complex-valued function f so that the algebra generated by A(K) and f is all of C(K). In particular, the results are applied to a harmonic function f to give sufficient conditions for the algebra generated by A(K) and f to be all of C(K). Also, sufficient conditions are given for the algebra A(K) to be a maximal subalgebra of C(K).